@@ -32,7 +32,6 @@ import androidx.localbroadcastmanager.content.LocalBroadcastManager
3232import kotlinx.coroutines.CoroutineScope
3333import kotlinx.coroutines.Dispatchers
3434import kotlinx.coroutines.SupervisorJob
35- import kotlinx.coroutines.flow.collect
3635import kotlinx.coroutines.launch
3736import org.openziti.ZitiContext
3837import org.openziti.net.dns.DNSResolver
@@ -104,7 +103,7 @@ object Ziti: CoroutineScope, Logged by ZitiLog() {
104103 })
105104
106105 val appId = app.packageName
107- val appVer = app.packageManager.getPackageInfo(appId, 0 ).versionName
106+ val appVer = getAppVersion()
108107 org.openziti.Ziti .setApplicationInfo(appId, appVer)
109108
110109 keyStore = KeyStore .getInstance(" AndroidKeyStore" )
@@ -170,8 +169,9 @@ object Ziti: CoroutineScope, Logged by ZitiLog() {
170169 }
171170
172171 fun enrollZiti (jwtUri : Uri ) {
173- val jwt = app.contentResolver.openInputStream(jwtUri)!! .readBytes()
174- enrollZiti(jwt)
172+ app.contentResolver.openInputStream(jwtUri)?.use {
173+ enrollZiti(it.readBytes())
174+ }
175175 }
176176
177177 fun enrollZiti (jwt : ByteArray ) {
@@ -203,11 +203,11 @@ object Ziti: CoroutineScope, Logged by ZitiLog() {
203203
204204 fun sendFeedbackIntent () = Intent (Intent .ACTION_SEND ).apply {
205205 type = " application/zip"
206- putExtra(Intent .EXTRA_EMAIL , arrayOf(" support@netfoundry.io " ))
206+ putExtra(Intent .EXTRA_EMAIL , arrayOf(" developers@openziti.org " ))
207207 putExtra(Intent .EXTRA_SUBJECT , app.getString(R .string.supportEmailSubject))
208208
209209 val identities = Impl .getContexts()
210- val ids = if (identities.isNullOrEmpty ()) {
210+ val ids = if (identities.isEmpty ()) {
211211 " no enrollments"
212212 } else {
213213 identities.joinToString(separator = " \n " ) {
@@ -216,16 +216,16 @@ object Ziti: CoroutineScope, Logged by ZitiLog() {
216216 }
217217
218218 val bodyString = """
219- |Device: ${Build .MODEL } (${Build .MANUFACTURER } )
220- |Android Version: ${Build .VERSION .RELEASE }
221- |Android-SDK: ${Build .VERSION .SDK_INT }
222- |Ziti Version: ${BuildConfig .ZITI_VERSION } (${Version .revision} )
223- |App: ${app.packageName}
224- |App Version: ${app.packageManager.getPackageInfo(app.packageName, 0 ).versionName }
225- |
226- |Enrollments:
227- |${ids}
228- |""" .trimMargin()
219+ |Device: ${Build .MODEL } (${Build .MANUFACTURER } )
220+ |Android Version: ${Build .VERSION .RELEASE }
221+ |Android-SDK: ${Build .VERSION .SDK_INT }
222+ |Ziti Version: ${BuildConfig .ZITI_VERSION } (${Version .revision} )
223+ |App: ${app.packageName}
224+ |App Version: ${getAppVersion() }
225+ |
226+ |Enrollments:
227+ |${ids}
228+ |""" .trimMargin()
229229
230230 putExtra(Intent .EXTRA_TEXT , bodyString)
231231
@@ -255,8 +255,12 @@ object Ziti: CoroutineScope, Logged by ZitiLog() {
255255 zip.flush()
256256 zip.close()
257257
258- putExtra(Intent .EXTRA_STREAM , FileProvider .getUriForFile(app,
259- " ${app.packageName} .provider" , logFile))
258+ putExtra(
259+ Intent .EXTRA_STREAM , FileProvider .getUriForFile(
260+ app,
261+ " ${app.packageName} .provider" , logFile
262+ )
263+ )
260264 }
261265
262266 @JvmStatic
@@ -274,4 +278,9 @@ object Ziti: CoroutineScope, Logged by ZitiLog() {
274278
275279 @JvmStatic
276280 fun getSSLSocketFactory () = Impl .getSSLSocketFactory()
281+
282+ fun getAppVersion (): String {
283+ val packageInfo = app.packageManager.getPackageInfo(app.packageName, 0 )
284+ return packageInfo.versionName
285+ }
277286}
0 commit comments