FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
httpsms/android/app/src/main/java/com/httpsms/Receiver.kt at main · blacdev/httpsms · GitHub
blacdev
/
httpsms
Public
forked from
NdoleStudio/httpsms
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
httpsms
/
android
/
app
/
src
/
main
/
java
/
com
/
httpsms
/
Receiver.kt
Copy path
More file actions
More file actions
Latest commit
History
History
History
73 lines (64 loc) · 2.61 KB
Breadcrumbs
httpsms
/
android
/
app
/
src
/
main
/
java
/
com
/
httpsms
/
Receiver.kt
Copy path
File metadata and controls
73 lines (64 loc) · 2.61 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package
com.httpsms
import
android.content.Context
import
android.content.Context.RECEIVER_EXPORTED
import
android.content.IntentFilter
import
android.os.Build
import
androidx.annotation.RequiresApi
import
timber.log.Timber
object
Receiver {
private
var
sentReceiver
:
SentReceiver
?
=
null
;
private
var
deliveredReceiver
:
DeliveredReceiver
?
=
null
;
fun
register
(
context
:
Context
) {
if
(sentReceiver
==
null
) {
Timber
.d(
"
registering [sent] receiver for intent [
${
SmsManagerService
.sentAction()}
]
"
)
sentReceiver
=
SentReceiver
()
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
TIRAMISU
) {
context.registerReceiver(
sentReceiver,
IntentFilter
(
SmsManagerService
.sentAction()),
RECEIVER_EXPORTED
)
}
else
{
context.registerReceiver(
sentReceiver,
IntentFilter
(
SmsManagerService
.sentAction())
)
}
}
if
(deliveredReceiver
==
null
) {
Timber
.d(
"
registering [delivered] receiver for intent [
${
SmsManagerService
.deliveredAction()}
]
"
)
deliveredReceiver
=
DeliveredReceiver
()
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
TIRAMISU
) {
context.registerReceiver(
deliveredReceiver,
IntentFilter
(
SmsManagerService
.deliveredAction()),
RECEIVER_EXPORTED
)
}
else
{
context.registerReceiver(
deliveredReceiver,
IntentFilter
(
SmsManagerService
.deliveredAction())
)
}
}
}
fun
isValid
(
context
:
Context
,
messageId
:
String?
):
Boolean
{
if
(messageId
==
null
) {
Timber
.e(
"
cannot handle event because the message ID is null
"
)
return
false
}
if
(
!
Settings
.isLoggedIn(context)) {
Timber
.w(
"
cannot handle message with id [
$messageId
] because the user is not logged in
"
)
return
false
}
if
(
!
Settings
.getActiveStatus(context,
Constants
.
SIM1
)
&&
!
Settings
.getActiveStatus(context,
Constants
.
SIM2
)) {
Timber
.w(
"
cannot handle message with id [
$messageId
] because the user is not active
"
)
return
false
}
if
(messageId.contains(
"
.
"
)) {
Timber
.d(
"
message id [
${messageId}
] is for multipart segment [
${messageId.split(
"
.
"
)[
1
]}
]
"
)
return
false
}
return
true
}
}
Back
|
FazBrowse Home
|
New Git URL