Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
dependencies ▾

Modern-Apps.git / communicate-dev / src / main / java / com / vayunmathur / communicate / data / rcs / RcsContentServer.kt

RcsContentServer.kt20 lines · 826 BRaw
1package com.vayunmathur.communicate.data.rcs
2
3/**
4 * FT content-server state for the RCS line: the provisioning watcher (here,
5 * with the line) publishes the carrier's file-transfer HTTP content server,
6 * and the host-side file-transfer glue reads it. Kept in this module so the
7 * watcher never references host repository code.
8 */
9object RcsContentServer {
10
11 /** The carrier FT HTTP content-server URI from provisioning, or null. */
12 var uri: String? = null
13
14 /** Pull the FT content-server URI out of RCS config XML (ftHTTPCSURI). */
15 fun parse(configXml: ByteArray): String? {
16 val xml = configXml.toString(Charsets.UTF_8)
17 return Regex("<ftHTTPCSURI>([^<]+)</ftHTTPCSURI>", RegexOption.IGNORE_CASE).find(xml)
18 ?.groupValues?.getOrNull(1)?.trim()?.takeIf { it.isNotEmpty() }
19 }
20}