Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nathan OBrian
Nebulo
Commits
c5830ea4
Commit
c5830ea4
authored
Jan 02, 2021
by
Daniel Wolf
Browse files
Use non-hardcoded telegram URL unless no browser is installed
parent
a93e0df0
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/com/frostnerd/smokescreen/Extensions.kt
View file @
c5830ea4
...
...
@@ -430,7 +430,7 @@ val Context.isPrivateDnsActive: Boolean
}
}
fun
Context
.
try
OpenBrowser
(
withLink
:
String
)
{
fun
Context
.
try
ViewUri
(
withLink
:
String
,
alternativeLink
:
String
?
=
null
)
{
try
{
startActivity
(
Intent
(
...
...
@@ -439,7 +439,10 @@ fun Context.tryOpenBrowser(withLink:String) {
)
)
}
catch
(
e
:
ActivityNotFoundException
)
{
Toast
.
makeText
(
this
,
R
.
string
.
error_no_webbrowser_installed
,
Toast
.
LENGTH_LONG
).
show
()
log
(
"Got ${e.message} when trying to open link: $withLink"
)
if
(
alternativeLink
!=
null
)
{
tryViewUri
(
alternativeLink
)
}
else
Toast
.
makeText
(
this
,
R
.
string
.
error_no_webbrowser_installed
,
Toast
.
LENGTH_LONG
).
show
()
}
}
...
...
@@ -462,5 +465,5 @@ fun Context.askOpenFAQ(topic: FAQTopic?) {
}
fun
Context
.
openFAQ
(
topic
:
FAQTopic
?)
{
tryOpenBrowser
(
"https://nebulo.app/faq#${topic?.id ?: ""}"
)
}
\ No newline at end of file
tryViewUri
(
"https://nebulo.app/faq#${topic?.id ?: ""}"
)
}
app/src/main/java/com/frostnerd/smokescreen/activity/MainActivity.kt
View file @
c5830ea4
...
...
@@ -157,11 +157,7 @@ class MainActivity : NavigationDrawerActivity() {
getString
(
R
.
string
.
dialog_join_group_message
),
getString
(
R
.
string
.
dialog_join_group_positive
)
to
{
dialog
,
_
->
dialog
.
dismiss
()
val
intent
=
Intent
(
Intent
.
ACTION_VIEW
,
Uri
.
parse
(
"tg://join?invite=I54nRleveRGP8IPmcIdySg"
)
)
startActivity
(
intent
)
tryViewUri
(
"https://nebulo.app/community"
,
"tg://join?invite=I54nRleveRGP8IPmcIdySg"
)
},
getString
(
R
.
string
.
dialog_crashreporting_negative
)
to
{
dialog
,
_
->
dialog
.
dismiss
()
...
...
app/src/main/java/com/frostnerd/smokescreen/fragment/AboutFragment.kt
View file @
c5830ea4
...
...
@@ -56,8 +56,7 @@ class AboutFragment : Fragment() {
}
if
(
isPackageInstalled
(
requireContext
(),
"org.telegram.messenger"
))
{
view
.
group
.
setOnClickListener
{
val
intent
=
Intent
(
Intent
.
ACTION_VIEW
,
Uri
.
parse
(
"tg://join?invite=I54nRleveRGP8IPmcIdySg"
))
startActivity
(
intent
)
context
?.
tryViewUri
(
"https://nebulo.app/community"
,
"tg://join?invite=I54nRleveRGP8IPmcIdySg"
)
}
}
else
{
view
.
group
.
visibility
=
View
.
GONE
...
...
@@ -124,7 +123,7 @@ class AboutFragment : Fragment() {
true
}
view
.
faq
.
setOnClickListener
{
requireContext
().
try
OpenBrowser
(
"https://nebulo.app/faq"
)
requireContext
().
try
ViewUri
(
"https://nebulo.app/faq"
)
}
}
...
...
Write
Preview
Supports
Markdown
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