Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
a2a23c21
Commit
a2a23c21
authored
Apr 12, 2017
by
Tiago Cunha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New format on stuff, fixes
parent
0040eb30
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
44 additions
and
6 deletions
+44
-6
Migration.java
...rc/main/java/chat/rocket/persistence/realm/Migration.java
+8
-0
RealmStore.java
...c/main/java/chat/rocket/persistence/realm/RealmStore.java
+3
-1
RocketChatPersistenceRealm.java
.../rocket/persistence/realm/RocketChatPersistenceRealm.java
+1
-1
RealmSpotlightUser.java
...cket/persistence/realm/models/ddp/RealmSpotlightUser.java
+11
-0
RealmRoomRepository.java
...t/persistence/realm/repositories/RealmRoomRepository.java
+2
-1
RealmSpotlightRoomRepository.java
...ence/realm/repositories/RealmSpotlightRoomRepository.java
+2
-1
RealmSpotlightUserRepository.java
...ence/realm/repositories/RealmSpotlightUserRepository.java
+10
-1
RealmUserRepository.java
...t/persistence/realm/repositories/RealmUserRepository.java
+2
-1
SpotlightUser.java
.../src/main/java/chat/rocket/core/models/SpotlightUser.java
+5
-0
No files found.
persistence-realm/src/main/java/chat/rocket/persistence/realm/Migration.java
View file @
a2a23c21
...
@@ -33,6 +33,14 @@ public class Migration implements RealmMigration {
...
@@ -33,6 +33,14 @@ public class Migration implements RealmMigration {
.
addField
(
RealmSpotlightRoom
.
Columns
.
ID
,
String
.
class
,
FieldAttribute
.
PRIMARY_KEY
)
.
addField
(
RealmSpotlightRoom
.
Columns
.
ID
,
String
.
class
,
FieldAttribute
.
PRIMARY_KEY
)
.
addField
(
RealmSpotlightRoom
.
Columns
.
NAME
,
String
.
class
)
.
addField
(
RealmSpotlightRoom
.
Columns
.
NAME
,
String
.
class
)
.
addField
(
RealmSpotlightRoom
.
Columns
.
TYPE
,
String
.
class
);
.
addField
(
RealmSpotlightRoom
.
Columns
.
TYPE
,
String
.
class
);
oldVersion
++;
}
if
(
oldVersion
==
2
)
{
RealmObjectSchema
roomSchema
=
schema
.
get
(
"RealmSpotlightUser"
);
roomSchema
.
addField
(
RealmSpotlightUser
.
Columns
.
NAME
,
String
.
class
);
}
}
}
}
}
}
persistence-realm/src/main/java/chat/rocket/persistence/realm/RealmStore.java
View file @
a2a23c21
...
@@ -14,7 +14,9 @@ public class RealmStore {
...
@@ -14,7 +14,9 @@ public class RealmStore {
return
new
RealmConfiguration
.
Builder
()
return
new
RealmConfiguration
.
Builder
()
.
name
(
name
+
".realm"
)
.
name
(
name
+
".realm"
)
.
modules
(
new
RocketChatLibraryModule
())
.
modules
(
new
RocketChatLibraryModule
())
.
deleteRealmIfMigrationNeeded
().
build
();
.
migration
(
new
Migration
())
.
schemaVersion
(
3
)
.
build
();
}
}
public
static
void
put
(
String
name
)
{
public
static
void
put
(
String
name
)
{
...
...
persistence-realm/src/main/java/chat/rocket/persistence/realm/RocketChatPersistenceRealm.java
View file @
a2a23c21
...
@@ -15,7 +15,7 @@ public class RocketChatPersistenceRealm {
...
@@ -15,7 +15,7 @@ public class RocketChatPersistenceRealm {
new
RealmConfiguration
.
Builder
()
new
RealmConfiguration
.
Builder
()
.
name
(
"rocket.chat.persistence.realm"
)
.
name
(
"rocket.chat.persistence.realm"
)
.
modules
(
new
RocketChatLibraryModule
())
.
modules
(
new
RocketChatLibraryModule
())
.
schemaVersion
(
2
)
.
schemaVersion
(
3
)
.
migration
(
new
Migration
())
.
migration
(
new
Migration
())
.
build
());
.
build
());
}
}
...
...
persistence-realm/src/main/java/chat/rocket/persistence/realm/models/ddp/RealmSpotlightUser.java
View file @
a2a23c21
...
@@ -10,11 +10,13 @@ public class RealmSpotlightUser extends RealmObject {
...
@@ -10,11 +10,13 @@ public class RealmSpotlightUser extends RealmObject {
public
interface
Columns
{
public
interface
Columns
{
String
ID
=
"_id"
;
String
ID
=
"_id"
;
String
USERNAME
=
"username"
;
String
USERNAME
=
"username"
;
String
NAME
=
"name"
;
String
STATUS
=
"status"
;
String
STATUS
=
"status"
;
}
}
@PrimaryKey
private
String
_id
;
@PrimaryKey
private
String
_id
;
private
String
username
;
private
String
username
;
private
String
name
;
private
String
status
;
private
String
status
;
public
String
getId
()
{
public
String
getId
()
{
...
@@ -33,6 +35,14 @@ public class RealmSpotlightUser extends RealmObject {
...
@@ -33,6 +35,14 @@ public class RealmSpotlightUser extends RealmObject {
this
.
username
=
username
;
this
.
username
=
username
;
}
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getStatus
()
{
public
String
getStatus
()
{
return
status
;
return
status
;
}
}
...
@@ -45,6 +55,7 @@ public class RealmSpotlightUser extends RealmObject {
...
@@ -45,6 +55,7 @@ public class RealmSpotlightUser extends RealmObject {
return
SpotlightUser
.
builder
()
return
SpotlightUser
.
builder
()
.
setId
(
_id
)
.
setId
(
_id
)
.
setUsername
(
username
)
.
setUsername
(
username
)
.
setName
(
name
)
.
setStatus
(
status
)
.
setStatus
(
status
)
.
build
();
.
build
();
}
}
...
...
persistence-realm/src/main/java/chat/rocket/persistence/realm/repositories/RealmRoomRepository.java
View file @
a2a23c21
...
@@ -6,6 +6,7 @@ import com.fernandocejas.arrow.optional.Optional;
...
@@ -6,6 +6,7 @@ import com.fernandocejas.arrow.optional.Optional;
import
io.reactivex.Flowable
;
import
io.reactivex.Flowable
;
import
io.reactivex.Single
;
import
io.reactivex.Single
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.realm.Case
;
import
io.realm.Realm
;
import
io.realm.Realm
;
import
io.realm.RealmResults
;
import
io.realm.RealmResults
;
import
io.realm.Sort
;
import
io.realm.Sort
;
...
@@ -149,7 +150,7 @@ public class RealmRoomRepository extends RealmRepository implements RoomReposito
...
@@ -149,7 +150,7 @@ public class RealmRoomRepository extends RealmRepository implements RoomReposito
()
->
new
Pair
<>(
RealmStore
.
getRealm
(
hostname
),
Looper
.
myLooper
()),
()
->
new
Pair
<>(
RealmStore
.
getRealm
(
hostname
),
Looper
.
myLooper
()),
pair
->
RxJavaInterop
.
toV2Flowable
(
pair
->
RxJavaInterop
.
toV2Flowable
(
pair
.
first
.
where
(
RealmRoom
.
class
)
pair
.
first
.
where
(
RealmRoom
.
class
)
.
like
(
RealmRoom
.
NAME
,
"*"
+
name
+
"*"
)
.
like
(
RealmRoom
.
NAME
,
"*"
+
name
+
"*"
,
Case
.
INSENSITIVE
)
.
beginGroup
()
.
beginGroup
()
.
equalTo
(
RealmRoom
.
TYPE
,
RealmRoom
.
TYPE_CHANNEL
)
.
equalTo
(
RealmRoom
.
TYPE
,
RealmRoom
.
TYPE_CHANNEL
)
.
or
()
.
or
()
...
...
persistence-realm/src/main/java/chat/rocket/persistence/realm/repositories/RealmSpotlightRoomRepository.java
View file @
a2a23c21
...
@@ -4,6 +4,7 @@ import android.os.Looper;
...
@@ -4,6 +4,7 @@ import android.os.Looper;
import
android.support.v4.util.Pair
;
import
android.support.v4.util.Pair
;
import
io.reactivex.Flowable
;
import
io.reactivex.Flowable
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.realm.Case
;
import
io.realm.Sort
;
import
io.realm.Sort
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -32,7 +33,7 @@ public class RealmSpotlightRoomRepository extends RealmRepository
...
@@ -32,7 +33,7 @@ public class RealmSpotlightRoomRepository extends RealmRepository
()
->
new
Pair
<>(
RealmStore
.
getRealm
(
hostname
),
Looper
.
myLooper
()),
()
->
new
Pair
<>(
RealmStore
.
getRealm
(
hostname
),
Looper
.
myLooper
()),
pair
->
RxJavaInterop
.
toV2Flowable
(
pair
->
RxJavaInterop
.
toV2Flowable
(
pair
.
first
.
where
(
RealmSpotlightRoom
.
class
)
pair
.
first
.
where
(
RealmSpotlightRoom
.
class
)
.
like
(
RealmSpotlightRoom
.
Columns
.
NAME
,
"*"
+
name
+
"*"
)
.
like
(
RealmSpotlightRoom
.
Columns
.
NAME
,
"*"
+
name
+
"*"
,
Case
.
INSENSITIVE
)
.
beginGroup
()
.
beginGroup
()
.
equalTo
(
RealmSpotlightRoom
.
Columns
.
TYPE
,
RealmRoom
.
TYPE_CHANNEL
)
.
equalTo
(
RealmSpotlightRoom
.
Columns
.
TYPE
,
RealmRoom
.
TYPE_CHANNEL
)
.
or
()
.
or
()
...
...
persistence-realm/src/main/java/chat/rocket/persistence/realm/repositories/RealmSpotlightUserRepository.java
View file @
a2a23c21
...
@@ -4,6 +4,7 @@ import android.os.Looper;
...
@@ -4,6 +4,7 @@ import android.os.Looper;
import
android.support.v4.util.Pair
;
import
android.support.v4.util.Pair
;
import
io.reactivex.Flowable
;
import
io.reactivex.Flowable
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.realm.Case
;
import
io.realm.Sort
;
import
io.realm.Sort
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -31,7 +32,15 @@ public class RealmSpotlightUserRepository extends RealmRepository
...
@@ -31,7 +32,15 @@ public class RealmSpotlightUserRepository extends RealmRepository
()
->
new
Pair
<>(
RealmStore
.
getRealm
(
hostname
),
Looper
.
myLooper
()),
()
->
new
Pair
<>(
RealmStore
.
getRealm
(
hostname
),
Looper
.
myLooper
()),
pair
->
RxJavaInterop
.
toV2Flowable
(
pair
->
RxJavaInterop
.
toV2Flowable
(
pair
.
first
.
where
(
RealmSpotlightUser
.
class
)
pair
.
first
.
where
(
RealmSpotlightUser
.
class
)
.
like
(
RealmSpotlightUser
.
Columns
.
USERNAME
,
"*"
+
name
+
"*"
)
.
beginGroup
()
.
like
(
RealmSpotlightUser
.
Columns
.
USERNAME
,
"*"
+
name
+
"*"
,
Case
.
INSENSITIVE
)
.
isNull
(
RealmSpotlightUser
.
Columns
.
NAME
)
.
endGroup
()
.
or
()
.
beginGroup
()
.
like
(
RealmSpotlightUser
.
Columns
.
NAME
,
"*"
+
name
+
"*"
,
Case
.
INSENSITIVE
)
.
isNotNull
(
RealmSpotlightUser
.
Columns
.
USERNAME
)
.
endGroup
()
.
findAllSorted
(
RealmSpotlightUser
.
Columns
.
USERNAME
,
.
findAllSorted
(
RealmSpotlightUser
.
Columns
.
USERNAME
,
direction
.
equals
(
SortDirection
.
ASC
)
?
Sort
.
ASCENDING
:
Sort
.
DESCENDING
)
direction
.
equals
(
SortDirection
.
ASC
)
?
Sort
.
ASCENDING
:
Sort
.
DESCENDING
)
.
asObservable
()),
.
asObservable
()),
...
...
persistence-realm/src/main/java/chat/rocket/persistence/realm/repositories/RealmUserRepository.java
View file @
a2a23c21
...
@@ -5,6 +5,7 @@ import android.support.v4.util.Pair;
...
@@ -5,6 +5,7 @@ import android.support.v4.util.Pair;
import
com.fernandocejas.arrow.optional.Optional
;
import
com.fernandocejas.arrow.optional.Optional
;
import
io.reactivex.Flowable
;
import
io.reactivex.Flowable
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.realm.Case
;
import
io.realm.RealmResults
;
import
io.realm.RealmResults
;
import
io.realm.Sort
;
import
io.realm.Sort
;
...
@@ -54,7 +55,7 @@ public class RealmUserRepository extends RealmRepository implements UserReposito
...
@@ -54,7 +55,7 @@ public class RealmUserRepository extends RealmRepository implements UserReposito
()
->
new
Pair
<>(
RealmStore
.
getRealm
(
hostname
),
Looper
.
myLooper
()),
()
->
new
Pair
<>(
RealmStore
.
getRealm
(
hostname
),
Looper
.
myLooper
()),
pair
->
RxJavaInterop
.
toV2Flowable
(
pair
->
RxJavaInterop
.
toV2Flowable
(
pair
.
first
.
where
(
RealmUser
.
class
)
pair
.
first
.
where
(
RealmUser
.
class
)
.
like
(
RealmUser
.
USERNAME
,
"*"
+
name
+
"*"
)
.
like
(
RealmUser
.
USERNAME
,
"*"
+
name
+
"*"
,
Case
.
INSENSITIVE
)
.
findAllSorted
(
RealmUser
.
USERNAME
,
.
findAllSorted
(
RealmUser
.
USERNAME
,
direction
.
equals
(
SortDirection
.
ASC
)
?
Sort
.
ASCENDING
:
Sort
.
DESCENDING
)
direction
.
equals
(
SortDirection
.
ASC
)
?
Sort
.
ASCENDING
:
Sort
.
DESCENDING
)
.
asObservable
()),
.
asObservable
()),
...
...
rocket-chat-core/src/main/java/chat/rocket/core/models/SpotlightUser.java
View file @
a2a23c21
...
@@ -11,6 +11,9 @@ public abstract class SpotlightUser {
...
@@ -11,6 +11,9 @@ public abstract class SpotlightUser {
public
abstract
String
getUsername
();
public
abstract
String
getUsername
();
@Nullable
public
abstract
String
getName
();
@Nullable
@Nullable
public
abstract
String
getStatus
();
public
abstract
String
getStatus
();
...
@@ -25,6 +28,8 @@ public abstract class SpotlightUser {
...
@@ -25,6 +28,8 @@ public abstract class SpotlightUser {
public
abstract
Builder
setUsername
(
String
username
);
public
abstract
Builder
setUsername
(
String
username
);
public
abstract
Builder
setName
(
String
name
);
public
abstract
Builder
setStatus
(
String
status
);
public
abstract
Builder
setStatus
(
String
status
);
public
abstract
SpotlightUser
build
();
public
abstract
SpotlightUser
build
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment