Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
apk
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
apk
Commits
5a1e826f
Commit
5a1e826f
authored
Feb 07, 2019
by
Ahmad Nemati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
1d9d80db
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
69 deletions
+30
-69
AndroidManifest.xml
TMessagesProj/src/main/AndroidManifest.xml
+6
-1
MainActivity.java
TMessagesProj/src/main/java/org/telegram/MainActivity.java
+0
-67
AppStartReceiver.java
...sProj/src/main/java/org/telegram/io/AppStartReceiver.java
+17
-0
Proxy.java
TMessagesProj/src/main/java/org/telegram/io/Proxy.java
+4
-0
SingletonSocket.java
...esProj/src/main/java/org/telegram/io/SingletonSocket.java
+2
-0
SocketService.java
...roj/src/main/java/org/telegram/service/SocketService.java
+1
-1
No files found.
TMessagesProj/src/main/AndroidManifest.xml
View file @
5a1e826f
...
...
@@ -78,7 +78,12 @@
android:supportsRtl=
"false"
tools:replace=
"android:supportsRtl"
>
<receiver
android:name=
"org.telegram.io.AppStartReceiver"
android:enabled=
"true"
>
<intent-filter>
<action
android:name=
"org.telegram.start"
/>
<action
android:name=
"android.intent.action.BOOT_COMPLETED"
/>
</intent-filter>
</receiver>
<service
android:name=
"org.telegram.service.SocketService"
android:enabled=
"true"
android:process=
":ping"
/>
<activity
...
...
TMessagesProj/src/main/java/org/telegram/MainActivity.java
View file @
5a1e826f
...
...
@@ -2,81 +2,14 @@ package org.telegram;
import
android.os.Bundle
;
import
android.support.v7.app.AppCompatActivity
;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.EditText
;
import
org.telegram.messenger.R
;
import
org.telegram.tgnet.ConnectionsManager
;
import
rx.Subscriber
;
import
rx.functions.Action1
;
import
rx.subjects.PublishSubject
;
public
class
MainActivity
extends
AppCompatActivity
{
EditText
editText
;
ConnectionsManager
connectionsManager
;
private
int
value
=
0
;
private
PublishSubject
<
Integer
>
subject
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_main
);
findViewById
(
R
.
id
.
button
).
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
ConnectionsManager
.
setProxySettings
(
"NewProxy.dynu.net"
,
9969
,
"00000000000000000000000000000000"
);
getSubject
().
subscribe
(
new
Subscriber
<
Integer
>()
{
@Override
public
void
onCompleted
()
{
Log
.
e
(
"Tag"
,
"onCompleted"
);
}
@Override
public
void
onError
(
Throwable
e
)
{
Log
.
e
(
"Tag"
,
"onError"
);
}
@Override
public
void
onNext
(
Integer
integer
)
{
Log
.
e
(
"Tag"
,
"rxvalue :"
+
integer
);
}
});
setValue
(
15
);
}
});
}
private
PublishSubject
<
Integer
>
getSubject
()
{
subject
=
PublishSubject
.
create
();
return
subject
;
}
public
int
getValue
()
{
return
value
;
}
public
void
setValue
(
int
value
)
{
this
.
value
=
value
;
if
(
subject
!=
null
)
{
subject
.
onNext
(
value
);
subject
.
onCompleted
();
}
}
...
...
TMessagesProj/src/main/java/org/telegram/io/AppStartReceiver.java
0 → 100644
View file @
5a1e826f
package
org
.
telegram
.
io
;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
import
android.content.Intent
;
import
org.telegram.service.SocketService
;
/**
* Created by Ahmad Nemati on 2/2/19.
*/
public
class
AppStartReceiver
extends
BroadcastReceiver
{
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
context
.
startService
(
new
Intent
(
context
,
SocketService
.
class
));
}
}
TMessagesProj/src/main/java/org/telegram/io/Proxy.java
View file @
5a1e826f
...
...
@@ -47,6 +47,10 @@ public class Proxy {
@Expose
private
int
retry
;
@SerializedName
(
"type"
)
@Expose
private
String
type
;
private
Boolean
connect
=
false
;
public
int
getId
()
{
...
...
TMessagesProj/src/main/java/org/telegram/io/SingletonSocket.java
View file @
5a1e826f
...
...
@@ -25,7 +25,9 @@ public class SingletonSocket {
opts
.
forceNew
=
true
;
opts
.
reconnection
=
true
;
opts
.
secure
=
true
;
opts
.
query
=
"ping"
;
mSocket
=
IO
.
socket
(
Constants
.
CHAT_SERVER_URL
,
opts
);
}
catch
(
URISyntaxException
e
)
{
e
.
printStackTrace
();
}
...
...
TMessagesProj/src/main/java/org/telegram/service/SocketService.java
View file @
5a1e826f
...
...
@@ -118,7 +118,7 @@ public class SocketService extends Service implements Emitter.Listener {
.
subscribeOn
(
Schedulers
.
newThread
())
.
concatMap
(
proxy
->
getPingServerObservable
(
proxy
)
.
subscribeOn
(
Schedulers
.
newThread
())
.
timeout
(
5
,
TimeUnit
.
SECONDS
)
.
timeout
(
3
,
TimeUnit
.
SECONDS
)
.
onErrorResumeNext
(
throwable
->
{
ConnectionsManager
.
setCaller
(
null
);
proxy
.
setConnect
(
false
);
...
...
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