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
4bfb9b10
Unverified
Commit
4bfb9b10
authored
Mar 26, 2018
by
Leonardo Aramaki
Committed by
GitHub
Mar 26, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop-2.x' into feature/migration
parents
801f6da3
1456a347
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
151 additions
and
87 deletions
+151
-87
config.yml
.circleci/config.yml
+114
-0
build.gradle
app/build.gradle
+2
-0
ChatRoomPresenter.kt
...rocket/android/chatroom/presentation/ChatRoomPresenter.kt
+6
-3
ChatRoomActivity.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomActivity.kt
+5
-3
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+5
-0
ChatRoomsFragment.kt
...ava/chat/rocket/android/chatrooms/ui/ChatRoomsFragment.kt
+1
-0
MessageParser.kt
...src/main/java/chat/rocket/android/helper/MessageParser.kt
+6
-9
MembersFragment.kt
...in/java/chat/rocket/android/members/ui/MembersFragment.kt
+0
-6
Ui.kt
app/src/main/java/chat/rocket/android/util/extensions/Ui.kt
+4
-2
item_message.xml
app/src/main/res/layout/item_message.xml
+8
-1
circle.yml
circle.yml
+0
-63
No files found.
.circleci/config.yml
0 → 100644
View file @
4bfb9b10
version
:
2
jobs
:
build-kotlin-sdk
:
docker
:
-
image
:
circleci/android:api-27-alpha
environment
:
JVM_OPTS
:
-Xmx3200m
steps
:
-
checkout
-
run
:
name
:
checkout Rocket.Chat.Kotlin.SDK
command
:
git clone https://github.com/RocketChat/Rocket.Chat.Kotlin.SDK.git ../Rocket.Chat.Kotlin.SDK
-
run
:
name
:
ANDROID_HOME
command
:
echo "sdk.dir="$ANDROID_HOME > local.properties
-
run
:
name
:
Build Kotlin.SDK
command
:
pushd app/ ; ./build-sdk.sh ; popd
-
save_cache
:
paths
:
-
~/.gradle
key
:
jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}-{{ checksum "player/build.gradle" }}
-
save_cache
:
paths
:
-
app/libs/
-
../Rocket.Chat.Kotlin.SDK/.last_commit_hash
key
:
kotlin-sdk-{{ .Revision }}
-
store_artifacts
:
path
:
app/libs/
destination
:
libs
code-analysis
:
docker
:
-
image
:
circleci/android:api-27-alpha
environment
:
JVM_OPTS
:
-Xmx3200m
steps
:
-
checkout
-
run
:
name
:
ANDROID_HOME
command
:
echo "sdk.dir="$ANDROID_HOME > local.properties
-
run
:
name
:
checkout Rocket.Chat.Kotlin.SDK
command
:
git clone https://github.com/RocketChat/Rocket.Chat.Kotlin.SDK.git ../Rocket.Chat.Kotlin.SDK
-
restore_cache
:
key
:
kotlin-sdk-{{ .Revision }}
-
restore_cache
:
key
:
jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}-{{ checksum "player/build.gradle" }}
-
run
:
name
:
Download Dependencies
command
:
./gradlew androidDependencies --quiet --console=plain
-
save_cache
:
paths
:
-
~/.gradle
key
:
jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}-{{ checksum "player/build.gradle" }}
-
run
:
name
:
Run Lint
#, Checkstyles, PMD, Findbugs...
command
:
./gradlew lint
-
run
:
name
:
Run Unit test
command
:
echo ./gradlew test
# TODO: Fix unit test errors soon...
-
store_artifacts
:
path
:
app/build/reports/
destination
:
reports
build-apk
:
docker
:
-
image
:
circleci/android:api-27-alpha
environment
:
JVM_OPTS
:
-Xmx3200m
steps
:
-
checkout
-
run
:
name
:
restore files from ENV
command
:
|
echo $ROCKET_JKS_BASE64 | base64 --decode > Rocket.jks
echo $ROCKET_PLAY_JSON | base64 --decode > app/rocket-chat.json
-
run
:
name
:
checkout Rocket.Chat.Kotlin.SDK
command
:
git clone https://github.com/RocketChat/Rocket.Chat.Kotlin.SDK.git ../Rocket.Chat.Kotlin.SDK
-
restore_cache
:
key
:
kotlin-sdk-{{ .Revision }}
-
restore_cache
:
key
:
jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}-{{ checksum "player/build.gradle" }}
-
run
:
name
:
Download Dependencies
command
:
./gradlew androidDependencies --quiet --console=plain
-
save_cache
:
paths
:
-
~/.gradle
key
:
jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}-{{ checksum "player/build.gradle" }}
-
run
:
name
:
Build APK
command
:
|
./gradlew assembleRelease --quiet --console=plain --stacktrace
-
store_artifacts
:
path
:
app/build/outputs/apk
destination
:
apks
workflows
:
version
:
2
build-deploy
:
jobs
:
-
build-kotlin-sdk
-
code-analysis
:
requires
:
-
build-kotlin-sdk
filters
:
branches
:
ignore
:
# skip on merge commits.
-
develop
-
develop-2.x
-
master
-
build-apk
:
requires
:
-
build-kotlin-sdk
app/build.gradle
View file @
4bfb9b10
...
...
@@ -111,6 +111,8 @@ dependencies {
androidTestImplementation
(
libraries
.
expressoCore
,
{
exclude
group:
'com.android.support'
,
module:
'support-annotations'
})
implementation
'com.android.support:customtabs:27.0.2'
}
kotlin
{
...
...
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomPresenter.kt
View file @
4bfb9b10
...
...
@@ -71,13 +71,13 @@ class ChatRoomPresenter @Inject constructor(private val view: ChatRoomView,
client
.
messages
(
chatRoomId
,
roomTypeOf
(
chatRoomType
),
offset
,
30
).
result
messagesRepository
.
saveAll
(
messages
)
val
messagesViewModels
=
mapper
.
map
(
messages
)
view
.
showMessages
(
messagesViewModels
)
// TODO: For now we are marking the room as read if we can get the messages (I mean, no exception occurs)
// but should mark only when the user see the first unread message.
markRoomAsRead
(
chatRoomId
)
val
messagesViewModels
=
mapper
.
map
(
messages
)
view
.
showMessages
(
messagesViewModels
)
subscribeMessages
(
chatRoomId
)
}
catch
(
ex
:
Exception
)
{
ex
.
printStackTrace
()
...
...
@@ -230,6 +230,9 @@ class ChatRoomPresenter @Inject constructor(private val view: ChatRoomView,
fun
unsubscribeMessages
(
chatRoomId
:
String
)
{
manager
.
removeStatusChannel
(
stateChannel
)
manager
.
unsubscribeRoomMessages
(
chatRoomId
)
// All messages during the subscribed period are assumed to be read,
// and lastSeen is updated as the time when the user leaves the room
markRoomAsRead
(
chatRoomId
)
}
/**
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomActivity.kt
View file @
4bfb9b10
...
...
@@ -86,11 +86,13 @@ class ChatRoomActivity : AppCompatActivity(), HasSupportFragmentInjector {
isChatRoomSubscribed
=
intent
.
getBooleanExtra
(
INTENT_CHAT_IS_SUBSCRIBED
,
true
)
if
(
supportFragmentManager
.
findFragmentByTag
(
"ChatRoomFragment"
)
==
null
)
{
addFragment
(
"ChatRoomFragment"
,
R
.
id
.
fragment_container
)
{
newInstance
(
chatRoomId
,
chatRoomName
,
chatRoomType
,
isChatRoomReadOnly
,
chatRoomLastSeen
,
isChatRoomSubscribed
)
}
}
}
override
fun
onBackPressed
()
{
finishActivity
()
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
4bfb9b10
...
...
@@ -131,6 +131,11 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
presenter
.
unsubscribeMessages
(
chatRoomId
)
handler
.
removeCallbacksAndMessages
(
null
)
unsubscribeTextMessage
()
// Hides the keyboard (if it's opened) before going to any view.
activity
?.
apply
{
hideKeyboard
()
}
super
.
onDestroyView
()
}
...
...
app/src/main/java/chat/rocket/android/chatrooms/ui/ChatRoomsFragment.kt
View file @
4bfb9b10
...
...
@@ -73,6 +73,7 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
val
searchItem
=
menu
.
findItem
(
R
.
id
.
action_search
)
searchView
=
searchItem
?.
actionView
as
SearchView
searchView
?.
maxWidth
=
Integer
.
MAX_VALUE
searchView
?.
setOnQueryTextListener
(
object
:
SearchView
.
OnQueryTextListener
{
override
fun
onQueryTextSubmit
(
query
:
String
?):
Boolean
{
return
queryChatRoomsByName
(
query
)
...
...
app/src/main/java/chat/rocket/android/helper/MessageParser.kt
View file @
4bfb9b10
...
...
@@ -7,6 +7,7 @@ import android.content.Intent
import
android.graphics.*
import
android.graphics.drawable.Drawable
import
android.net.Uri
import
android.support.customtabs.CustomTabsIntent
import
android.provider.Browser
import
android.support.v4.content.ContextCompat
import
android.support.v4.content.res.ResourcesCompat
...
...
@@ -171,16 +172,12 @@ class MessageParser @Inject constructor(val context: Application, private val co
if
(!
link
.
startsWith
(
"@"
)
&&
link
!
in
consumed
)
{
builder
.
setSpan
(
object
:
ClickableSpan
()
{
override
fun
onClick
(
view
:
View
)
{
val
uri
=
getUri
(
link
)
val
context
=
view
.
context
val
intent
=
Intent
(
Intent
.
ACTION_VIEW
,
uri
)
intent
.
putExtra
(
Browser
.
EXTRA_APPLICATION_ID
,
context
.
packageName
)
try
{
context
.
startActivity
(
intent
)
}
catch
(
e
:
ActivityNotFoundException
)
{
Timber
.
e
(
"Actvity was not found for intent, $intent"
)
with
(
view
)
{
val
tabsbuilder
=
CustomTabsIntent
.
Builder
()
tabsbuilder
.
setToolbarColor
(
ResourcesCompat
.
getColor
(
context
.
resources
,
R
.
color
.
colorPrimary
,
context
.
theme
))
val
customTabsIntent
=
tabsbuilder
.
build
()
customTabsIntent
.
launchUrl
(
context
,
getUri
(
link
))
}
}
},
matcher
.
start
(
0
),
matcher
.
end
(
0
))
consumed
.
add
(
link
)
...
...
app/src/main/java/chat/rocket/android/members/ui/MembersFragment.kt
View file @
4bfb9b10
...
...
@@ -15,7 +15,6 @@ import chat.rocket.android.members.adapter.MembersAdapter
import
chat.rocket.android.members.presentation.MembersPresenter
import
chat.rocket.android.members.presentation.MembersView
import
chat.rocket.android.members.viewmodel.MemberViewModel
import
chat.rocket.android.util.extensions.hideKeyboard
import
chat.rocket.android.util.extensions.inflate
import
chat.rocket.android.util.extensions.setVisible
import
chat.rocket.android.util.extensions.showToast
...
...
@@ -23,9 +22,6 @@ import chat.rocket.android.widget.DividerItemDecoration
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_members.*
import
javax.inject.Inject
import
android.view.inputmethod.InputMethodManager.HIDE_IMPLICIT_ONLY
import
android.app.Activity
import
android.view.inputmethod.InputMethodManager
fun
newInstance
(
chatRoomId
:
String
,
chatRoomType
:
String
):
Fragment
{
...
...
@@ -65,8 +61,6 @@ class MembersFragment : Fragment(), MembersView {
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
super
.
onViewCreated
(
view
,
savedInstanceState
)
val
imm
=
activity
?.
getSystemService
(
Activity
.
INPUT_METHOD_SERVICE
)
as
InputMethodManager
imm
.
toggleSoftInput
(
InputMethodManager
.
HIDE_IMPLICIT_ONLY
,
0
)
(
activity
as
AppCompatActivity
).
supportActionBar
?.
title
=
""
...
...
app/src/main/java/chat/rocket/android/util/extensions/Ui.kt
View file @
4bfb9b10
...
...
@@ -49,8 +49,10 @@ fun AppCompatActivity.addFragmentBackStack(tag: String, layoutId: Int,
}
fun
Activity
.
hideKeyboard
()
{
if
(
currentFocus
!=
null
)
{
val
imm
=
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
)
as
InputMethodManager
imm
.
hideSoftInputFromWindow
(
currentFocus
.
windowToken
,
InputMethodManager
.
RESULT_UNCHANGED_SHOWN
)
}
}
fun
Activity
.
showToast
(
@StringRes
resource
:
Int
,
duration
:
Int
=
Toast
.
LENGTH_SHORT
)
=
...
...
app/src/main/res/layout/item_message.xml
View file @
4bfb9b10
...
...
@@ -35,13 +35,20 @@
android:layout_height=
"1dp"
android:layout_width=
"0dp"
android:layout_weight=
"1"
android:layout_margin
Right
=
"4dp"
android:layout_margin
End
=
"4dp"
android:background=
"@color/red"
/>
<TextView
android:layout_width=
"wrap_content"
android:text=
"@string/msg_unread_messages"
android:layout_height=
"wrap_content"
android:textColor=
"@color/red"
/>
<View
android:layout_gravity=
"center"
android:layout_height=
"1dp"
android:layout_width=
"0dp"
android:layout_weight=
"1"
android:layout_marginStart=
"4dp"
android:background=
"@color/red"
/>
</LinearLayout>
<LinearLayout
...
...
circle.yml
deleted
100644 → 0
View file @
801f6da3
#
# Build configuration for Circle CI
#
# See this thread for speeding up and caching directories: https://discuss.circleci.com/t/installing-android-build-tools-23-0-2/924
#
machine
:
environment
:
ANDROID_HOME
:
/usr/local/android-sdk-linux
GRADLE_OPTS
:
'
-Xmx1536M
-Dorg.gradle.jvmargs="-Xmx1536M
-XX:MaxPermSize=512m
-XX:+HeapDumpOnOutOfMemoryError"'
JAVA_OPTS
:
"
-Xms518m
-Xmx1536M"
pre
:
-
git clone https://github.com/RocketChat/Rocket.Chat.Kotlin.SDK.git Rocket.Chat.Kotlin.SDK
dependencies
:
pre
:
-
sudo service mysql stop; sleep 5
-
sudo service mongod stop; sleep 5
-
sudo killall postgres; sleep 5
-
git fetch --tags
-
echo "sdk.dir="$ANDROID_HOME > local.properties
-
echo $ROCKET_JKS_BASE64 | base64 --decode > Rocket.jks
-
echo $ROCKET_PLAY_JSON | base64 --decode > app/rocket-chat.json
-
mkdir -p app/src/release/res/values
# TODO: remove the comment when using that file on the project
# - echo $GOOGLE_SERVICES_BASE64 | base64 --decode > app/src/release/google-services.json
# - echo $API_KEY_STRINGS_BASE64 | base64 --decode > app/src/release/res/values/api_key_strings.xml
-
mkdir -p $ANDROID_HOME/licenses/
-
echo 8933bad161af4178b1185d1a37fbf41ea5269c55 >> $ANDROID_HOME/licenses/android-sdk-license
-
echo d56f5187479451eabf01fb78af6dfcb131a6481e >> $ANDROID_HOME/licenses/android-sdk-license
-
echo y | android update sdk --no-ui --all --filter tools,platform-tools
-
echo y | android update sdk --no-ui --all --filter android-27
-
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-27.0.0
#- yes | sdkmanager --licenses
cache_directories
:
#- /usr/local/android-sdk-linux/tools
#- /usr/local/android-sdk-linux/build-tools/27.0.0
test
:
override
:
-
./gradlew assembleRelease --stacktrace
-
find . -name *.apk -exec mv {} $CIRCLE_ARTIFACTS/ \;
deployment
:
beta
:
tag
:
/v\d+\.\d+\.\d+(?!.)/
owner
:
RocketChat
commands
:
-
./gradlew publishListingRelease
-Dorg.gradle.project.track=beta
alpha
:
tag
:
/v\d+\.\d+\.\d+/
owner
:
RocketChat
commands
:
-
./gradlew publishListingRelease
-Dorg.gradle.pr oject.track=alpha
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