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
58209fac
Commit
58209fac
authored
Apr 23, 2018
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat.Android into new/active-users
And add missing Hindi translations.
parents
953973da
c2aeacce
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
132 additions
and
62 deletions
+132
-62
build.gradle
app/build.gradle
+1
-1
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+0
-1
VersionCheckView.kt
...id/authentication/server/presentation/VersionCheckView.kt
+11
-0
ServerFragment.kt
...rocket/android/authentication/server/ui/ServerFragment.kt
+48
-3
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+5
-27
CheckServerPresenter.kt
...ocket/android/server/presentation/CheckServerPresenter.kt
+9
-0
String.kt
...c/main/java/chat/rocket/android/util/extensions/String.kt
+6
-1
fragment_authentication_server.xml
app/src/main/res/layout/fragment_authentication_server.xml
+18
-12
strings.xml
app/src/main/res/values-hi-rIN/strings.xml
+10
-5
strings.xml
app/src/main/res/values-pt-rBR/strings.xml
+12
-6
strings.xml
app/src/main/res/values/strings.xml
+12
-6
No files found.
app/build.gradle
View file @
58209fac
...
...
@@ -13,7 +13,7 @@ android {
applicationId
"chat.rocket.android"
minSdkVersion
21
targetSdkVersion
versions
.
targetSdk
versionCode
201
3
versionCode
201
4
versionName
"2.1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled
true
...
...
app/src/main/AndroidManifest.xml
View file @
58209fac
...
...
@@ -5,7 +5,6 @@
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.WAKE_LOCK"
/>
<uses-permission
android:name=
"android.permission.VIBRATE"
/>
<uses-permission
android:name=
"android.permission.READ_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"com.google.android.c2dm.permission.RECEIVE"
/>
<permission
...
...
app/src/main/java/chat/rocket/android/authentication/server/presentation/VersionCheckView.kt
View file @
58209fac
...
...
@@ -11,8 +11,19 @@ interface VersionCheckView {
*/
fun
blockAndAlertNotRequiredVersion
()
/**
* Alerts the user that an error has occurred while checking the server version
* This is optional.
*/
fun
errorCheckingServerVersion
()
{}
/**
* Do some action if version is ok. This is optional.
*/
fun
versionOk
()
{}
/**
* Alters the user this protocol is invalid. This is optional.
*/
fun
errorInvalidProtocol
()
{}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/authentication/server/ui/ServerFragment.kt
View file @
58209fac
...
...
@@ -8,6 +8,8 @@ import android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewTreeObserver
import
android.widget.AdapterView
import
android.widget.ArrayAdapter
import
chat.rocket.android.BuildConfig
import
chat.rocket.android.R
import
chat.rocket.android.authentication.domain.model.LoginDeepLinkInfo
...
...
@@ -38,6 +40,8 @@ class ServerFragment : Fragment(), ServerView {
}
}
private
var
protocol
=
"https://"
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
AndroidSupportInjection
.
inject
(
this
)
...
...
@@ -55,9 +59,40 @@ class ServerFragment : Fragment(), ServerView {
deepLinkInfo
?.
let
{
val
uri
=
Uri
.
parse
(
it
.
url
)
uri
?.
let
{
text_server_
protoco
l
.
hintContent
=
it
.
host
}
uri
?.
let
{
text_server_
ur
l
.
hintContent
=
it
.
host
}
presenter
.
deepLink
(
it
)
}
text_server_protocol
.
adapter
=
ArrayAdapter
<
String
>(
activity
,
android
.
R
.
layout
.
simple_dropdown_item_1line
,
arrayOf
(
"https://"
,
"http://"
))
text_server_protocol
.
onItemSelectedListener
=
object
:
AdapterView
.
OnItemSelectedListener
{
override
fun
onItemSelected
(
parent
:
AdapterView
<
*
>?,
view
:
View
?,
position
:
Int
,
id
:
Long
)
{
when
(
position
)
{
0
->
{
protocol
=
"https://"
}
1
->
{
ui
{
AlertDialog
.
Builder
(
it
)
.
setTitle
(
R
.
string
.
msg_warning
)
.
setMessage
(
R
.
string
.
msg_http_insecure
)
.
setPositiveButton
(
R
.
string
.
msg_proceed
)
{
_
,
_
->
protocol
=
"http://"
}
.
setNegativeButton
(
R
.
string
.
msg_cancel
)
{
_
,
_
->
text_server_protocol
.
setSelection
(
0
)
}
.
setCancelable
(
false
)
.
create
()
.
show
()
}
}
}
}
override
fun
onNothingSelected
(
parent
:
AdapterView
<
*
>?)
{
}
}
}
override
fun
onDestroyView
()
{
...
...
@@ -129,13 +164,23 @@ class ServerFragment : Fragment(), ServerView {
performConnect
()
}
override
fun
errorCheckingServerVersion
()
{
hideLoading
()
showMessage
(
R
.
string
.
msg_error_checking_server_version
)
}
override
fun
errorInvalidProtocol
()
{
hideLoading
()
showMessage
(
R
.
string
.
msg_invalid_server_protocol
)
}
private
fun
performConnect
()
{
ui
{
deepLinkInfo
?.
let
{
presenter
.
deepLink
(
it
)
}.
ifNull
{
val
url
=
text_server_url
.
textContent
.
ifEmpty
(
text_server_url
.
hintContent
)
presenter
.
connect
(
text_server_protocol
.
textContent
+
url
)
presenter
.
connect
(
"${protocol}${url.sanitize()}"
)
}
}
}
...
...
@@ -149,7 +194,7 @@ class ServerFragment : Fragment(), ServerView {
ui
{
button_connect
.
setOnClickListener
{
val
url
=
text_server_url
.
textContent
.
ifEmpty
(
text_server_url
.
hintContent
)
presenter
.
checkServer
(
text_server_protocol
.
textContent
+
url
)
presenter
.
checkServer
(
"${protocol}${url.sanitize()}"
)
}
}
}
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
58209fac
package
chat.rocket.android.chatroom.ui
import
android.Manifest
import
android.app.Activity
import
android.content.ClipData
import
android.content.ClipboardManager
import
android.content.Context
import
android.content.Intent
import
android.content.pm.PackageManager
import
android.net.Uri
import
android.os.Bundle
import
android.os.Handler
import
android.support.annotation.DrawableRes
import
android.support.v4.app.ActivityCompat
import
android.support.v4.app.Fragment
import
android.support.v4.content.ContextCompat
import
android.support.v7.widget.DefaultItemAnimator
import
android.support.v7.widget.LinearLayoutManager
import
android.support.v7.widget.RecyclerView
...
...
@@ -468,29 +464,11 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
override
fun
showFileSelection
(
filter
:
Array
<
String
>)
{
ui
{
if
(
ContextCompat
.
checkSelfPermission
(
it
,
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
ActivityCompat
.
requestPermissions
(
it
,
arrayOf
(
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
),
1
)
}
else
{
val
intent
=
Intent
(
Intent
.
ACTION_GET_CONTENT
)
intent
.
type
=
"*/*"
intent
.
putExtra
(
Intent
.
EXTRA_MIME_TYPES
,
filter
)
startActivityForResult
(
intent
,
REQUEST_CODE_FOR_PERFORM_SAF
)
}
}
}
override
fun
onRequestPermissionsResult
(
requestCode
:
Int
,
permissions
:
Array
<
out
String
>,
grantResults
:
IntArray
)
{
when
(
requestCode
)
{
1
->
{
if
(!(
grantResults
.
isNotEmpty
()
&&
grantResults
.
first
()
==
PackageManager
.
PERMISSION_GRANTED
))
{
handler
.
postDelayed
({
ui
{
hideAttachmentOptions
()
}
},
400
)
}
}
val
intent
=
Intent
(
Intent
.
ACTION_GET_CONTENT
)
intent
.
type
=
"*/*"
intent
.
putExtra
(
Intent
.
EXTRA_MIME_TYPES
,
filter
)
intent
.
addCategory
(
Intent
.
CATEGORY_OPENABLE
)
startActivityForResult
(
intent
,
REQUEST_CODE_FOR_PERFORM_SAF
)
}
}
...
...
app/src/main/java/chat/rocket/android/server/presentation/CheckServerPresenter.kt
View file @
58209fac
...
...
@@ -7,6 +7,7 @@ import chat.rocket.android.server.infraestructure.RocketChatClientFactory
import
chat.rocket.android.util.VersionInfo
import
chat.rocket.android.util.extensions.launchUI
import
chat.rocket.android.util.retryIO
import
chat.rocket.common.RocketChatInvalidProtocolException
import
chat.rocket.core.RocketChatClient
import
chat.rocket.core.internal.rest.serverInfo
import
kotlinx.coroutines.experimental.Deferred
...
...
@@ -42,6 +43,14 @@ abstract class CheckServerPresenter constructor(private val strategy: CancelStra
}
}
catch
(
ex
:
Exception
)
{
Timber
.
d
(
ex
,
"Error getting server info"
)
when
(
ex
)
{
is
RocketChatInvalidProtocolException
->
{
view
.
errorInvalidProtocol
()
}
else
->
{
view
.
errorCheckingServerVersion
()
}
}
}
}
}
...
...
app/src/main/java/chat/rocket/android/util/extensions/String.kt
View file @
58209fac
...
...
@@ -4,12 +4,17 @@ import android.util.Patterns
fun
String
.
removeTrailingSlash
():
String
{
return
if
(
isNotEmpty
()
&&
this
[
length
-
1
]
==
'/'
)
{
this
.
replace
(
"/+$"
,
""
)
this
.
substring
(
0
,
length
-
1
)
}
else
{
this
}
}
fun
String
.
sanitize
():
String
{
val
tmp
=
this
.
trim
()
return
tmp
.
removeTrailingSlash
()
}
fun
String
.
avatarUrl
(
avatar
:
String
,
isGroupOrChannel
:
Boolean
=
false
,
format
:
String
=
"jpeg"
):
String
{
return
if
(
isGroupOrChannel
)
{
"${removeTrailingSlash()}/avatar/%23${avatar.removeTrailingSlash()}?format=$format"
...
...
app/src/main/res/layout/fragment_authentication_server.xml
View file @
58209fac
...
...
@@ -18,24 +18,30 @@
android:id=
"@+id/text_server_url"
style=
"@style/Authentication.EditText"
android:layout_below=
"@id/text_headline"
android:layout_marginStart=
"-
4
dp"
android:layout_marginStart=
"-
6
dp"
android:layout_marginTop=
"32dp"
android:layout_toEndOf=
"@id/
text_server_protocol
"
android:layout_toEndOf=
"@id/
protocol_container
"
android:cursorVisible=
"false"
android:hint=
"@string/default_server"
android:imeOptions=
"actionDone"
android:digits=
"0123456789abcdefghijklmnopqrstuvwxyz.-/:"
android:inputType=
"textUri"
android:paddingEnd=
"0dp"
android:paddingStart=
"4dp"
/>
android:inputType=
"text|textUri"
android:paddingEnd=
"0dp"
/>
<TextView
android:id=
"@+id/text_server_protocol"
style=
"@style/Authentication.TextView"
<FrameLayout
android:id=
"@+id/protocol_container"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:background=
"@drawable/style_edit_text_authentication"
android:layout_marginStart=
"@dimen/screen_edge_left_and_right_margins"
android:layout_below=
"@id/text_headline"
android:layout_marginTop=
"32dp"
android:gravity=
"center_vertical"
android:text=
"@string/default_protocol"
/>
android:layout_marginTop=
"32dp"
>
<Spinner
android:id=
"@+id/text_server_protocol"
android:spinnerMode=
"dropdown"
android:layout_width=
"120dp"
android:layout_height=
"50dp"
android:backgroundTint=
"@color/actionMenuColor"
/>
</FrameLayout>
<com.wang.avi.AVLoadingIndicatorView
android:id=
"@+id/view_loading"
...
...
app/src/main/res/values-hi-rIN/strings.xml
View file @
58209fac
<resources>
<resources
<!--
Titles
--
>
<string
name=
"title_sign_in_your_server"
>
अपने सर्वर में साइन इन करें
</string>
<string
name=
"title_log_in"
>
लॉग इन करें
</string>
...
...
@@ -80,6 +79,8 @@
<string
name=
"msg_preview_photo"
>
तस्वीरें
</string>
<string
name=
"msg_unread_messages"
>
अपठित संदेश
</string>
<string
name=
"msg_no_messages_yet"
>
अभी तक कोई पोस्ट नहीं
</string>
<string
name=
"msg_version"
>
वर्शन
</string>
<string
name=
"msg_build"
>
बिल्ड
</string>
<string
name=
"msg_ok"
>
OK
</string>
<string
name=
"msg_ver_not_recommended"
>
ऐसा लगता है कि आपका सर्वर संस्करण अनुशंसित संस्करण %1$s के नीचे है।\nआप अभी भी लॉगिन कर सकते हैं लेकिन आप अप्रत्याशित व्यवहार का अनुभव कर सकते हैं
...
...
@@ -87,8 +88,12 @@
<string
name=
"msg_ver_not_minimum"
>
ऐसा लगता है कि आपका सर्वर संस्करण न्यूनतम आवश्यक संस्करण %1$s से कम है।\nकृपया लॉगिन करने के लिए अपने सर्वर को अपग्रेड करें!
</string>
<string
name=
"msg_version"
>
वर्शन
</string>
<string
name=
"msg_build"
>
बिल्ड
</string>
<string
name=
"msg_proceed"
>
आगे बढ़ें
</string>
<string
name=
"msg_cancel"
>
रद्द करना
</string>
<string
name=
"msg_warning"
>
चेतावनी
</string>
<string
name=
"msg_http_insecure"
>
HTTP का उपयोग करते समय, आप एक असुरक्षित सर्वर से कनेक्ट हो रहे हैं। हम आपको ऐसा करने की सलाह नहीं देते हैं।
</string>
<string
name=
"msg_error_checking_server_version"
>
आपके सर्वर संस्करण की जांच करते समय एक त्रुटि आई है, कृपया पुनः प्रयास करें
</string>
<string
name=
"msg_invalid_server_protocol"
>
चयनित प्रोटोकॉल इस सर्वर द्वारा स्वीकार नहीं किया गया है, HTTPS का उपयोग करने का प्रयास करें
</string>
<!-- System messages -->
<string
name=
"message_room_name_changed"
>
%2$s ने रूम का नाम बदलकर %1$s किया
</string>
...
...
@@ -187,4 +192,4 @@
<string
name=
"notif_action_reply_hint"
>
जवाब
</string>
<string
name=
"notif_error_sending"
>
उत्तर विफल हुआ है। कृपया फिर से प्रयास करें।
</string>
<string
name=
"notif_success_sending"
>
संदेश भेजा गया %1$s!
</string>
</resources>
\ No newline at end of file
</resources>
app/src/main/res/values-pt-rBR/strings.xml
View file @
58209fac
...
...
@@ -89,6 +89,12 @@
<string
name=
"msg_ver_not_minimum"
>
Parece que a versão do seu servidor está abaixo da mínima requerida %1$s.\nPor favor, atualize seus servidores antes de continuar!
</string>
<string
name=
"msg_proceed"
>
CONTINUAR
</string>
<string
name=
"msg_cancel"
>
CANCELAR
</string>
<string
name=
"msg_warning"
>
AVISO
</string>
<string
name=
"msg_http_insecure"
>
Usando HTTP, você estará conectando a um servidor não seguro, não recomendamos sua utilização.
</string>
<string
name=
"msg_error_checking_server_version"
>
Ocorreu um erro verificando a versão do servidor, por favor tente novamente
</string>
<string
name=
"msg_invalid_server_protocol"
>
O protocolo selecionado não é suportado pelo servidor, por favor utilize HTTPS e tente novamente
</string>
<!-- System messages -->
<string
name=
"message_room_name_changed"
>
Nome da sala alterado para: %1$s por %2$s
</string>
...
...
@@ -130,12 +136,12 @@
<string
name=
"max_file_size_exceeded"
>
Tamanho de arquivo (%1$d bytes) excedeu tamanho máximo de upload (%2$d bytes)
</string>
<!-- Socket status -->
<string
name=
"status_connected"
>
c
onectado
</string>
<string
name=
"status_disconnected"
>
d
esconetado
</string>
<string
name=
"status_connecting"
>
c
onectando
</string>
<string
name=
"status_authenticating"
>
a
utenticando
</string>
<string
name=
"status_disconnecting"
>
d
esconectando
</string>
<string
name=
"status_waiting"
>
c
onectando em %d segundos
</string>
<string
name=
"status_connected"
>
C
onectado
</string>
<string
name=
"status_disconnected"
>
D
esconetado
</string>
<string
name=
"status_connecting"
>
C
onectando
</string>
<string
name=
"status_authenticating"
>
A
utenticando
</string>
<string
name=
"status_disconnecting"
>
D
esconectando
</string>
<string
name=
"status_waiting"
>
C
onectando em %d segundos
</string>
<!--Suggestions-->
<string
name=
"suggest_all_description"
>
Notifica todos nesta sala
</string>
...
...
app/src/main/res/values/strings.xml
View file @
58209fac
...
...
@@ -90,6 +90,12 @@
<string
name=
"msg_ver_not_minimum"
>
Looks like your server version is below the minimum required version %1$s.\nPlease upgrade your server to login!
</string>
<string
name=
"msg_proceed"
>
PROCEED
</string>
<string
name=
"msg_cancel"
>
CANCEL
</string>
<string
name=
"msg_warning"
>
WARNING
</string>
<string
name=
"msg_http_insecure"
>
When using HTTP, you\'re connecting to an insecure server. We don\'t recommend you doing that.
</string>
<string
name=
"msg_error_checking_server_version"
>
An error has occurred while checking your server version, please try again
</string>
<string
name=
"msg_invalid_server_protocol"
>
The selected protocol is not accepted by this server, try using HTTPS
</string>
<!-- System messages -->
<string
name=
"message_room_name_changed"
>
Room name changed to: %1$s by %2$s
</string>
...
...
@@ -131,12 +137,12 @@
<string
name=
"max_file_size_exceeded"
>
File size %1$d bytes exceeded max upload size of %2$d bytes
</string>
<!-- Socket status -->
<string
name=
"status_connected"
>
c
onnected
</string>
<string
name=
"status_disconnected"
>
d
isconnected
</string>
<string
name=
"status_connecting"
>
c
onnecting
</string>
<string
name=
"status_authenticating"
>
a
uthenticating
</string>
<string
name=
"status_disconnecting"
>
d
isconnecting
</string>
<string
name=
"status_waiting"
>
c
onnecting in %d seconds
</string>
<string
name=
"status_connected"
>
C
onnected
</string>
<string
name=
"status_disconnected"
>
D
isconnected
</string>
<string
name=
"status_connecting"
>
C
onnecting
</string>
<string
name=
"status_authenticating"
>
A
uthenticating
</string>
<string
name=
"status_disconnecting"
>
D
isconnecting
</string>
<string
name=
"status_waiting"
>
C
onnecting in %d seconds
</string>
<!--Suggestions-->
<string
name=
"suggest_all_description"
>
Notify all in this room
</string>
...
...
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