Skip to content

Commit 2171252

Browse files
authored
Merge pull request #352 from mudkipme/fix/memos-0-27
fix: memos 0.27.0 support
2 parents c9daac7 + 0bd89c1 commit 2171252

8 files changed

Lines changed: 19 additions & 53 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
You can use Moe Memos with either a self-hosted [✍️memos](https://github.com/usememos/memos) server or locally on your device (no server required).
1010

11-
**Note: Current Moe Memos version supports Memos 0.21.0 and Memos 0.26.0 to 0.26.2. Memos update may introduce breaking API changes. If you are using a version higher than 0.26.2, it is recommended to use [Mortis](https://github.com/mudkipme/mortis) to convert the newer Memos API to the Memos 0.21.0 API and re-login in Moe Memos.**
11+
**Note: Current Moe Memos version supports Memos 0.21.0 and Memos 0.27.0 to 0.27.1. Memos update may introduce breaking API changes. If you are using a version higher than 0.27.1, it is recommended to use [Mortis](https://github.com/mudkipme/mortis) to convert the newer Memos API to the Memos 0.21.0 API and re-login in Moe Memos.**
1212

1313
## Installation
1414

app/src/main/java/me/mudkip/moememos/data/model/Account.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import java.time.Instant
44

55
sealed class Account {
66
fun accountKey(): String = when (this) {
7-
is MemosV0 -> "memos:${this.info.host}:${this.info.id}"
8-
is MemosV1 -> "memos:${this.info.host}:${this.info.id}"
7+
is MemosV0 -> "memos:${this.info.host}:${this.info.remoteIdentifier}"
8+
is MemosV1 -> "memos:${this.info.host}:${this.info.remoteIdentifier}"
99
is Local -> "local"
1010
}
1111

@@ -50,7 +50,7 @@ private fun MemosAccount.toUser(): User {
5050
Instant.now()
5151
}
5252
return User(
53-
identifier = id.toString(),
53+
identifier = remoteIdentifier,
5454
name = name,
5555
startDate = startDate,
5656
defaultVisibility = visibility

app/src/main/java/me/mudkip/moememos/data/model/MemosAccount.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import java.net.URI
77
data class MemosAccount(
88
val host: String = "",
99
val accessToken: String = "",
10-
val id: Long = 0L,
1110
val name: String = "",
1211
val avatarUrl: String = "",
1312
val startDateEpochSecond: Long = 0L,

app/src/main/java/me/mudkip/moememos/ext/DataStoreExt.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ import me.mudkip.moememos.data.model.Settings
77
import me.mudkip.moememos.util.SettingsSerializer
88

99
val Context.settingsDataStore: DataStore<Settings> by dataStore(
10-
fileName = "settings_v2.json",
10+
fileName = "settings_v3.json",
1111
serializer = SettingsSerializer
1212
)

app/src/main/java/me/mudkip/moememos/util/Int53Hash.kt

Lines changed: 0 additions & 16 deletions
This file was deleted.

app/src/main/java/me/mudkip/moememos/viewmodel/UserStateViewModel.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import me.mudkip.moememos.data.model.UserData
2828
import me.mudkip.moememos.data.service.AccountService
2929
import me.mudkip.moememos.ext.string
3030
import me.mudkip.moememos.ext.suspendOnNotLogin
31-
import me.mudkip.moememos.util.toInt53Hash
3231
import okhttp3.OkHttpClient
3332
import java.time.Instant
3433
import javax.inject.Inject
@@ -178,7 +177,7 @@ class UserStateViewModel @Inject constructor(
178177
info = MemosAccount(
179178
host = host,
180179
accessToken = accessToken,
181-
id = user.id,
180+
remoteIdentifier = user.id.toString(),
182181
name = user.username ?: user.displayName,
183182
avatarUrl = user.avatarUrl ?: "",
184183
startDateEpochSecond = user.createdTs,
@@ -191,7 +190,6 @@ class UserStateViewModel @Inject constructor(
191190
info = MemosAccount(
192191
host = host,
193192
accessToken = accessToken,
194-
id = user.name.toInt53Hash(),
195193
name = user.username,
196194
avatarUrl = user.avatarUrl ?: "",
197195
startDateEpochSecond = user.createTime?.epochSecond ?: 0L,

app/src/test/java/me/mudkip/moememos/util/Int53HashTest.kt

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## What's Changed
2+
- Added support for Memos 0.27.0 and 0.27.1. Due to breaking API changes, Memos versions 0.22.0-0.26.2 are no longer supported. You can continue using Memos 0.21.0 or upgrade to 0.27.1.
3+
- Added Brazilian Portuguese localization by @ciro-mota.
4+
- Improved the home screen widget by @majo-icutech.
5+
- Added an optional account label to settings by jeff-bennett.
6+
- Fixed a crash when uploading large files.
7+
8+
## New Contributors
9+
* @ciro-mota made their first contribution in https://github.com/mudkipme/MoeMemosAndroid/pull/341
10+
* @majo-icutech made their first contribution in https://github.com/mudkipme/MoeMemosAndroid/pull/346
11+
* @jeff-bennett made their first contribution in https://github.com/mudkipme/MoeMemosAndroid/pull/349
12+
13+
**Full Changelog**: https://github.com/mudkipme/MoeMemosAndroid/compare/2.0.2...2.0.3

0 commit comments

Comments
 (0)