1
1
package me.proxer.app.settings
2
2
3
+ import android.content.ActivityNotFoundException
3
4
import android.content.ClipData
4
5
import android.content.ClipboardManager
5
6
import android.content.Context
7
+ import android.content.Intent
8
+ import android.net.Uri
6
9
import android.os.Bundle
7
10
import androidx.core.content.ContextCompat
8
11
import androidx.core.content.getSystemService
@@ -27,7 +30,6 @@ import me.proxer.app.chat.prv.Participant
27
30
import me.proxer.app.chat.prv.PrvMessengerActivity
28
31
import me.proxer.app.chat.prv.create.CreateConferenceActivity
29
32
import me.proxer.app.chat.prv.sync.MessengerDao
30
- import me.proxer.app.forum.TopicActivity
31
33
import me.proxer.app.profile.ProfileActivity
32
34
import me.proxer.app.settings.status.ServerStatusActivity
33
35
import me.proxer.app.util.extension.androidUri
@@ -54,12 +56,12 @@ class AboutFragment : MaterialAboutFragment(), CustomTabsAware {
54
56
private val discordLink = " https://discord.gg/XwrEDmA" .toPrefixedHttpUrl()
55
57
private val repositoryLink = " https://github.com/proxer/ProxerAndroid" .toPrefixedHttpUrl()
56
58
57
- private const val supportId = " 374605 "
58
- private const val supportCategory = " anwendungen "
59
+ private const val supportProxerMail = " [email protected] "
60
+ private const val supportProxerName = " Support "
59
61
62
+ private const val developerGithubName = " rubengees"
60
63
private const val developerProxerName = " RubyGee"
61
64
private const val developerProxerId = " 121658"
62
- private const val developerGithubName = " rubengees"
63
65
64
66
fun newInstance () = AboutFragment ().apply {
65
67
arguments = bundleOf()
@@ -235,19 +237,19 @@ class AboutFragment : MaterialAboutFragment(), CustomTabsAware {
235
237
.text(R .string.about_support_message_title)
236
238
.subText(R .string.about_support_message_description)
237
239
.icon(
238
- IconicsDrawable (context, CommunityMaterial .Icon .cmd_email ).apply {
240
+ IconicsDrawable (context, CommunityMaterial .Icon2 .cmd_forum ).apply {
239
241
colorInt = context.resolveColor(R .attr.colorIcon)
240
242
}
241
243
)
242
244
.setOnClickAction {
243
245
Completable
244
246
.fromAction {
245
- messengerDao.findConferenceForUser(developerProxerName ).let { existingConference ->
247
+ messengerDao.findConferenceForUser(supportProxerName ).let { existingConference ->
246
248
when (existingConference) {
247
249
null -> CreateConferenceActivity .navigateTo(
248
250
requireActivity(),
249
251
false ,
250
- Participant (developerProxerName )
252
+ Participant (supportProxerName )
251
253
)
252
254
else -> PrvMessengerActivity .navigateTo(requireActivity(), existingConference)
253
255
}
@@ -257,14 +259,27 @@ class AboutFragment : MaterialAboutFragment(), CustomTabsAware {
257
259
.subscribeAndLogErrors()
258
260
}.build(),
259
261
MaterialAboutActionItem .Builder ()
260
- .text(R .string.about_support_forum_title )
261
- .subText(R .string.about_support_forum_description )
262
+ .text(R .string.about_support_mail_title )
263
+ .subText(R .string.about_support_mail_description )
262
264
.icon(
263
- IconicsDrawable (context, CommunityMaterial .Icon2 .cmd_forum ).apply {
265
+ IconicsDrawable (context, CommunityMaterial .Icon .cmd_email ).apply {
264
266
colorInt = context.resolveColor(R .attr.colorIcon)
265
267
}
266
268
)
267
- .setOnClickAction { TopicActivity .navigateTo(requireActivity(), supportId, supportCategory) }
269
+ .setOnClickAction {
270
+ val intent = Intent (Intent .ACTION_SENDTO ).apply {
271
+ data = Uri .parse(" mailto:" )
272
+
273
+ putExtra(Intent .EXTRA_EMAIL , arrayOf(supportProxerMail))
274
+ putExtra(Intent .EXTRA_SUBJECT , getString(R .string.about_support_mail_subject))
275
+ }
276
+
277
+ try {
278
+ startActivity(intent)
279
+ } catch (error: ActivityNotFoundException ) {
280
+ requireContext().toast(R .string.about_error_mail_no_activity)
281
+ }
282
+ }
268
283
.build()
269
284
)
270
285
0 commit comments