core, mobile: enable xftp by default (#2198)

This commit is contained in:
spaced4ndy
2023-04-18 13:49:09 +04:00
committed by GitHub
parent 09481e09b6
commit b386cc83a7
6 changed files with 35 additions and 36 deletions

View File

@@ -1744,9 +1744,8 @@ open class ChatController(var ctrl: ChatCtrl?, val ntfManager: NtfManager, val a
}
}
fun getXFTPCfg(): XFTPFileConfig? {
val prefXFTPSendEnabled = appPrefs.xftpSendEnabled.get()
return if (prefXFTPSendEnabled) XFTPFileConfig(minFileSize = 0) else null
fun getXFTPCfg(): XFTPFileConfig {
return XFTPFileConfig(minFileSize = 0)
}
fun getNetCfg(): NetCfg {

View File

@@ -44,15 +44,15 @@ fun DeveloperView(
)
SectionSpacer()
val xftpSendEnabled = m.controller.appPrefs.xftpSendEnabled
val xftpEnabled = remember { mutableStateOf(xftpSendEnabled.get()) }
SectionView(generalGetString(R.string.settings_section_title_experimenta)) {
SettingsPreferenceItem(Icons.Outlined.UploadFile, stringResource(R.string.settings_send_files_via_xftp), xftpSendEnabled, xftpEnabled) {
withApi { m.controller.apiSetXFTPConfig(m.controller.getXFTPCfg()) }
}
}
if (xftpEnabled.value) {
SectionTextFooter(generalGetString(R.string.xftp_requires_v461))
}
// val xftpSendEnabled = m.controller.appPrefs.xftpSendEnabled
// val xftpEnabled = remember { mutableStateOf(xftpSendEnabled.get()) }
// SectionView(generalGetString(R.string.settings_section_title_experimenta)) {
// SettingsPreferenceItem(Icons.Outlined.UploadFile, stringResource(R.string.settings_send_files_via_xftp), xftpSendEnabled, xftpEnabled) {
// withApi { m.controller.apiSetXFTPConfig(m.controller.getXFTPCfg()) }
// }
// }
// if (xftpEnabled.value) {
// SectionTextFooter(generalGetString(R.string.xftp_requires_v461))
// }
}
}

View File

@@ -44,24 +44,24 @@ struct DeveloperView: View {
(developerTools ? Text("Show:") : Text("Hide:")) + Text(" ") + Text("Database IDs and Transport isolation option.")
}
Section {
settingsRow("arrow.up.doc") {
Toggle("Send videos and files via XFTP", isOn: $xftpSendEnabled)
.onChange(of: xftpSendEnabled) { _ in
do {
try setXFTPConfig(getXFTPCfg())
} catch {
logger.error("setXFTPConfig: cannot set XFTP config \(responseError(error))")
}
}
}
} header: {
Text("Experimental")
} footer: {
if xftpSendEnabled {
Text("v4.6.1+ is required to receive via XFTP.")
}
}
// Section {
// settingsRow("arrow.up.doc") {
// Toggle("Send videos and files via XFTP", isOn: $xftpSendEnabled)
// .onChange(of: xftpSendEnabled) { _ in
// do {
// try setXFTPConfig(getXFTPCfg())
// } catch {
// logger.error("setXFTPConfig: cannot set XFTP config \(responseError(error))")
// }
// }
// }
// } header: {
// Text("Experimental")
// } footer: {
// if xftpSendEnabled {
// Text("v4.6.1+ is required to receive via XFTP.")
// }
// }
}
}
}

View File

@@ -203,9 +203,8 @@ public class Default<T> {
}
}
public func getXFTPCfg() -> XFTPFileConfig? {
let xftpSendEnabled = xftpSendEnabledGroupDefault.get()
return xftpSendEnabled ? XFTPFileConfig(minFileSize: 0) : nil
public func getXFTPCfg() -> XFTPFileConfig {
return XFTPFileConfig(minFileSize: 0)
}
public func getNetCfg() -> NetCfg {

View File

@@ -110,7 +110,7 @@ defaultChatConfig =
fileChunkSize = 15780, -- do not change
xftpDescrPartSize = 14000,
inlineFiles = defaultInlineFilesConfig,
xftpFileConfig = Nothing,
xftpFileConfig = Just defaultXFTPFileConfig,
tempDir = Nothing,
logLevel = CLLImportant,
subscriptionEvents = False,

View File

@@ -111,7 +111,8 @@ testCfg =
defaultChatConfig
{ agentConfig = testAgentCfg,
testView = True,
tbqSize = 16
tbqSize = 16,
xftpFileConfig = Nothing
}
testAgentCfgV1 :: AgentConfig