refactor: migrate core UI and features to KMP, adopt Navigation 3 (#4750)

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
James Rich 2026-03-10 12:29:47 -05:00 committed by GitHub
parent b1070321fe
commit d076361c55
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
245 changed files with 3106 additions and 1748 deletions

View file

@ -0,0 +1,25 @@
/*
* Copyright (c) 2025-2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.meshtastic.core.common.util
import android.util.Base64
actual object Base64Factory {
actual fun encode(data: ByteArray): String = Base64.encodeToString(data, Base64.NO_WRAP)
actual fun decode(data: String): ByteArray = Base64.decode(data, Base64.NO_WRAP)
}

View file

@ -45,4 +45,16 @@ actual object DateFormatter {
DateFormat.getDateInstance(DateFormat.SHORT).format(timestampMillis)
}
}
actual fun formatTime(timestampMillis: Long): String =
DateFormat.getTimeInstance(DateFormat.SHORT).format(timestampMillis)
actual fun formatTimeWithSeconds(timestampMillis: Long): String =
DateFormat.getTimeInstance(DateFormat.MEDIUM).format(timestampMillis)
actual fun formatDate(timestampMillis: Long): String =
DateFormat.getDateInstance(DateFormat.SHORT).format(timestampMillis)
actual fun formatDateTimeShort(timestampMillis: Long): String =
DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM).format(timestampMillis)
}

View file

@ -0,0 +1,27 @@
/*
* Copyright (c) 2025-2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.meshtastic.core.common.util
import java.util.Locale
actual object NumberFormatter {
actual fun format(value: Double, decimalPlaces: Int): String =
String.format(Locale.ROOT, "%.${decimalPlaces}f", value)
actual fun format(value: Float, decimalPlaces: Int): String =
String.format(Locale.ROOT, "%.${decimalPlaces}f", value)
}

View file

@ -0,0 +1,23 @@
/*
* Copyright (c) 2025-2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.meshtastic.core.common.util
import java.net.URLEncoder
actual object UrlUtils {
actual fun encode(value: String): String = URLEncoder.encode(value, "UTF-8")
}

View file

@ -0,0 +1,24 @@
/*
* Copyright (c) 2025-2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.meshtastic.core.common.util
/** Platform-agnostic Base64 utility. */
expect object Base64Factory {
fun encode(data: ByteArray): String
fun decode(data: String): ByteArray
}

View file

@ -30,4 +30,16 @@ expect object DateFormatter {
* Typically shows time if within the last 24 hours, otherwise the date.
*/
fun formatShortDate(timestampMillis: Long): String
/** Formats a timestamp into a localized time string (HH:mm). */
fun formatTime(timestampMillis: Long): String
/** Formats a timestamp into a localized time string with seconds (HH:mm:ss). */
fun formatTimeWithSeconds(timestampMillis: Long): String
/** Formats a timestamp into a localized date string. */
fun formatDate(timestampMillis: Long): String
/** Formats a timestamp into a localized short date and medium time string. */
fun formatDateTimeShort(timestampMillis: Long): String
}

View file

@ -0,0 +1,26 @@
/*
* Copyright (c) 2025-2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.meshtastic.core.common.util
/** Platform-agnostic number formatting utility. */
expect object NumberFormatter {
/** Formats a double value with the specified number of decimal places. */
fun format(value: Double, decimalPlaces: Int): String
/** Formats a float value with the specified number of decimal places. */
fun format(value: Float, decimalPlaces: Int): String
}

View file

@ -0,0 +1,22 @@
/*
* Copyright (c) 2025-2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.meshtastic.core.common.util
/** Platform-agnostic URL encoding utility. */
expect object UrlUtils {
fun encode(value: String): String
}