Fix Export template

This commit is contained in:
Philoul 2023-08-17 20:00:42 +02:00
parent bed5b78229
commit 29e83705c2
4 changed files with 8 additions and 7 deletions

View file

@ -68,8 +68,7 @@ class WearFragment : DaggerFragment() {
updateGui()
}
binding.exportCustom.setOnClickListener {
wearPlugin.savedCustomWatchface?.let { importExportPrefs.exportCustomWatchface(it) }
?: apply { rxBus.send(EventMobileToWear(EventData.ActionrequestCustomWatchface(true)))}
rxBus.send(EventMobileToWear(EventData.ActionrequestCustomWatchface(true)))
}
}
@ -79,10 +78,12 @@ class WearFragment : DaggerFragment() {
.toObservable(EventWearUpdateGui::class.java)
.observeOn(aapsSchedulers.main)
.subscribe({
it.customWatchfaceData?.let { loadCustom(it) }
if (it.exportFile)
ToastUtils.okToast(activity, rh.gs(R.string.wear_new_custom_watchface_exported))
updateGui()
else {
it.customWatchfaceData?.let { loadCustom(it) }
updateGui()
}
}, fabricPrivacy::logException)
if (wearPlugin.savedCustomWatchface == null)
rxBus.send(EventMobileToWear(EventData.ActionrequestCustomWatchface(false)))

View file

@ -95,7 +95,7 @@ class WearPlugin @Inject constructor(
disposable += rxBus
.toObservable(EventWearUpdateGui::class.java)
.observeOn(aapsSchedulers.main)
.subscribe({ it.customWatchfaceData?.let { cwf -> savedCustomWatchface = cwf } }, fabricPrivacy::logException)
.subscribe({ it.customWatchfaceData?.let { cwf -> if (!it.exportFile) savedCustomWatchface = cwf } }, fabricPrivacy::logException)
}
override fun onStop() {

View file

@ -365,7 +365,7 @@
<string name="wear_load_watchface">Load Watchface</string>
<string name="wear_send_watchface">Send Watchface</string>
<string name="wear_export_watchface">Export template</string>
<string name="wear_new_custom_watchface_exported">Custom watchface exported</string>
<string name="wear_new_custom_watchface_exported">Custom watchface template exported</string>
<string name="resend_all_data">Resend All Data</string>
<string name="open_settings_on_wear">Open Settings on Wear</string>

View file

@ -204,7 +204,7 @@ class DataHandlerWear @Inject constructor(
.toObservable(EventData.ActionrequestCustomWatchface::class.java)
.observeOn(aapsSchedulers.io)
.subscribe { eventData ->
aapsLogger.debug(LTag.WEAR, "Custom Watchface requested from ${eventData.sourceNodeId}")
aapsLogger.debug(LTag.WEAR, "Custom Watchface requested from ${eventData.sourceNodeId} export ${eventData.exportFile}")
persistence.readCustomWatchface(eventData.exportFile)?.let {
rxBus.send(EventWearDataToMobile(EventData.ActionGetCustomWatchface(it, eventData.exportFile)))
}