Skip to content

Commit 70b9760

Browse files
authored
Merge pull request #145 from daniebeler/dev
Dev
2 parents 0fcf6c4 + c9cd3db commit 70b9760

File tree

9 files changed

+276
-270
lines changed

9 files changed

+276
-270
lines changed

app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ android {
1717
applicationId = "com.daniebeler.pfpixelix"
1818
minSdk = 26
1919
targetSdk = 35
20-
versionCode = 24
21-
versionName = "3.3.0"
20+
versionCode = 25
21+
versionName = "3.3.1"
2222

2323
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2424
vectorDrawables {

app/src/main/java/com/daniebeler/pfpixelix/data/remote/PixelfedApi.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,12 @@ interface PixelfedApi {
146146
@Body body: RequestBody
147147
): Call<AccountDto>
148148

149-
@GET("api/pixelfed/v1/accounts/{accountid}/statuses?pe=1")
149+
@GET("api/v1/accounts/{accountid}/statuses?pe=1")
150150
fun getPostsByAccountId(
151151
@Path("accountid") accountId: String, @Query("limit") limit: Int
152152
): Call<List<PostDto>>
153153

154-
@GET("api/pixelfed/v1/accounts/{accountid}/statuses?pe=1")
154+
@GET("api/v1/accounts/{accountid}/statuses?pe=1")
155155
fun getPostsByAccountId(
156156
@Path("accountid") accountId: String,
157157
@Query("max_id") maxId: String,

app/src/main/java/com/daniebeler/pfpixelix/ui/composables/post/PostComposable.kt

Lines changed: 48 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ fun PostComposable(
136136

137137
val context = LocalContext.current
138138

139+
var postId by remember { mutableStateOf(post.id) }
140+
139141
val sheetState = rememberModalBottomSheetState()
140142
var showBottomSheet by remember {
141143
mutableIntStateOf(
@@ -147,14 +149,15 @@ fun PostComposable(
147149
)
148150
}
149151

150-
151-
152152
DisposableEffect(post.createdAt) {
153153
viewModel.convertTime(post.createdAt)
154154
onDispose {}
155155
}
156156

157157
LaunchedEffect(Unit) {
158+
if (post.reblogId != null) {
159+
postId = post.reblogId
160+
}
158161
if (viewModel.post == null) {
159162
viewModel.updatePost(post)
160163
}
@@ -174,15 +177,10 @@ fun PostComposable(
174177

175178
LaunchedEffect(openReplies) {
176179
if (openReplies) {
177-
if (viewModel.post!!.rebloggedBy != null) {
178-
viewModel.loadReplies(
179-
viewModel.post?.reblogId ?: ""
180-
)
181-
} else {
182-
viewModel.loadReplies(
183-
viewModel.post!!.id
184-
)
185-
}
180+
viewModel.loadReplies(
181+
postId
182+
)
183+
186184
}
187185
}
188186

@@ -196,24 +194,21 @@ fun PostComposable(
196194
720f
197195
} else {
198196
0f
199-
},
200-
animationSpec = tween(durationMillis = 800, easing = EaseInOut)
197+
}, animationSpec = tween(durationMillis = 800, easing = EaseInOut)
201198
)
202199

203200

204201
var animateHeart by remember { mutableStateOf(false) }
205-
val heartScale by animateFloatAsState(
206-
targetValue = if (animateHeart) 1.3f else 1f,
202+
val heartScale by animateFloatAsState(targetValue = if (animateHeart) 1.3f else 1f,
207203
animationSpec = tween(durationMillis = 200, easing = LinearEasing),
208204
finishedListener = {
209205
animateHeart = false
210-
}
211-
)
206+
})
212207

213208
if (viewModel.post != null) {
214209
Column(modifier = modifier) {
215210

216-
post.rebloggedBy?.let {reblogAccount ->
211+
post.rebloggedBy?.let { reblogAccount ->
217212
Row(
218213
verticalAlignment = Alignment.CenterVertically,
219214
horizontalArrangement = Arrangement.spacedBy(8.dp),
@@ -226,7 +221,12 @@ fun PostComposable(
226221
})
227222
) {
228223
Icon(Icons.Outlined.Cached, contentDescription = "reblogged by")
229-
Text(stringResource(R.string.reblogged_by, reblogAccount.displayname ?: reblogAccount.username), fontSize = 12.sp)
224+
Text(
225+
stringResource(
226+
R.string.reblogged_by,
227+
reblogAccount.displayname ?: reblogAccount.username
228+
), fontSize = 12.sp
229+
)
230230
}
231231
}
232232

@@ -355,13 +355,11 @@ fun PostComposable(
355355
.zIndex(10f)
356356
.padding(start = 12.dp, end = 12.dp)
357357
) {
358-
PostImage(
359-
mediaAttachment = viewModel.post!!.mediaAttachments[page],
360-
viewModel.post!!.id,
358+
PostImage(mediaAttachment = viewModel.post!!.mediaAttachments[page],
359+
postId,
361360
setZindex = { setZindex(it) },
362361
viewModel,
363-
like = {animateHeart = true}
364-
)
362+
like = { animateHeart = true })
365363
}
366364
}
367365

@@ -408,26 +406,26 @@ fun PostComposable(
408406
.zIndex(10f)
409407
.padding(start = 12.dp, end = 12.dp)
410408
) {
411-
PostImage(
412-
mediaAttachment = viewModel.post!!.mediaAttachments[0],
413-
viewModel.post!!.id,
409+
PostImage(mediaAttachment = viewModel.post!!.mediaAttachments[0],
410+
postId,
414411
setZindex = { setZindex(it) },
415412
viewModel,
416-
like = {animateHeart = true}
417-
)
413+
like = { animateHeart = true })
418414
}
419415
}
420416
}
421417
} else {
422418
if (viewModel.post!!.content.isNotBlank()) {
423419
Column(Modifier.padding(start = 16.dp, top = 8.dp, end = 16.dp)) {
424420
HorizontalDivider()
425-
HashtagsMentionsTextView(text = viewModel.post!!.content,
421+
HashtagsMentionsTextView(
422+
text = viewModel.post!!.content,
426423
mentions = viewModel.post!!.mentions,
427424
navController = navController,
428425
textSize = 18.sp,
429426
openUrl = { url -> viewModel.openUrl(context, url) },
430-
modifier = Modifier.padding(top = 16.dp, bottom = 16.dp))
427+
modifier = Modifier.padding(top = 16.dp, bottom = 16.dp)
428+
)
431429
HorizontalDivider()
432430
}
433431
}
@@ -442,24 +440,23 @@ fun PostComposable(
442440

443441
Row(verticalAlignment = Alignment.CenterVertically) {
444442
if (viewModel.post!!.favourited) {
445-
Icon(
446-
imageVector = Icons.Filled.Favorite,
443+
Icon(imageVector = Icons.Filled.Favorite,
447444
modifier = Modifier
448445
.size(24.dp)
449446
.clickable {
450-
viewModel.unlikePost(viewModel.post!!.id)
451-
}.scale(heartScale),
447+
viewModel.unlikePost(postId)
448+
}
449+
.scale(heartScale),
452450
contentDescription = "unlike post",
453-
tint = Color(0xFFDD2E44)
454-
)
451+
tint = Color(0xFFDD2E44))
455452
} else {
456453
Icon(
457454
imageVector = Icons.Outlined.FavoriteBorder,
458455
modifier = Modifier
459456
.size(24.dp)
460457
.clickable {
461458
animateHeart = true
462-
viewModel.likePost(viewModel.post!!.id)
459+
viewModel.likePost(postId)
463460
},
464461
contentDescription = "like post"
465462
)
@@ -481,15 +478,9 @@ fun PostComposable(
481478
modifier = Modifier
482479
.size(24.dp)
483480
.clickable {
484-
if (viewModel.post!!.rebloggedBy != null) {
485-
viewModel.loadReplies(
486-
viewModel.post?.reblogId ?: ""
487-
)
488-
} else {
489-
viewModel.loadReplies(
490-
viewModel.post!!.id
491-
)
492-
}
481+
viewModel.loadReplies(
482+
postId
483+
)
493484
showBottomSheet = 1
494485
},
495486
contentDescription = "comments of post"
@@ -510,7 +501,7 @@ fun PostComposable(
510501

511502
if (viewModel.post!!.reblogged) {
512503
IconButton(onClick = {
513-
viewModel.unreblogPost(viewModel.post!!.id)
504+
viewModel.unreblogPost(postId)
514505
}) {
515506
Icon(
516507
imageVector = Icons.Outlined.Cached,
@@ -522,7 +513,7 @@ fun PostComposable(
522513
} else {
523514
IconButton(onClick = {
524515
animateBoost = true
525-
viewModel.reblogPost(viewModel.post!!.id)
516+
viewModel.reblogPost(postId)
526517
}) {
527518
Icon(
528519
imageVector = Icons.Outlined.Cached,
@@ -535,15 +526,16 @@ fun PostComposable(
535526

536527
if (viewModel.post!!.bookmarked) {
537528
IconButton(onClick = {
538-
viewModel.unBookmarkPost(post.id)
529+
viewModel.unBookmarkPost(postId)
539530
}) {
540531
Icon(
541-
imageVector = Icons.Filled.Bookmark, contentDescription = "unbookmark post"
532+
imageVector = Icons.Filled.Bookmark,
533+
contentDescription = "unbookmark post"
542534
)
543535
}
544536
} else {
545537
IconButton(onClick = {
546-
viewModel.bookmarkPost(post.id)
538+
viewModel.bookmarkPost(postId)
547539
}) {
548540
Icon(
549541
imageVector = Icons.Outlined.BookmarkBorder,
@@ -576,7 +568,7 @@ fun PostComposable(
576568
fontWeight = FontWeight.Bold,
577569
fontSize = 14.sp,
578570
modifier = Modifier.clickable {
579-
viewModel.loadLikedBy(post.id)
571+
viewModel.loadLikedBy(postId)
580572
showBottomSheet = 3
581573
})
582574
}
@@ -605,15 +597,9 @@ fun PostComposable(
605597
),
606598
color = MaterialTheme.colorScheme.onSurfaceVariant,
607599
modifier = Modifier.clickable {
608-
if (viewModel.post!!.rebloggedBy != null) {
609-
viewModel.loadReplies(
610-
viewModel.post?.reblogId ?: ""
611-
)
612-
} else {
613-
viewModel.loadReplies(
614-
viewModel.post!!.id
615-
)
616-
}
600+
viewModel.loadReplies(
601+
postId
602+
)
617603
showBottomSheet = 1
618604
})
619605
}

app/src/main/java/com/daniebeler/pfpixelix/ui/composables/settings/preferences/PreferencesComposable.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ fun PreferencesComposable(
8888
Scaffold(contentWindowInsets = WindowInsets.systemBars.only(WindowInsetsSides.Top),
8989
modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection),
9090
topBar = {
91-
CenterAlignedTopAppBar(windowInsets = WindowInsets(0, 0, 0, 0),
92-
scrollBehavior = scrollBehavior,
91+
CenterAlignedTopAppBar(scrollBehavior = scrollBehavior,
9392
title = {
9493
Text(text = stringResource(R.string.settings), fontWeight = FontWeight.Bold)
9594
},

app/src/main/res/values-ar-rSA/strings.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
<string name="followed_hashtags">Followed Hashtags</string>
88
<string name="blocked_accounts">Blocked Accounts</string>
99
<string name="muted_accounts">Muted Accounts</string>
10-
<string name="logout">الخروج</string>
11-
<string name="open_in_browser">إفتح في متصفح</string>
12-
<string name="share_this_profile">شارك هذه الصفحة الشخصية</string>
10+
<string name="logout">تسجيل الخروج</string>
11+
<string name="open_in_browser">فتح في المتصفح</string>
12+
<string name="share_this_profile">مشاركة هذا الملف الشخصي</string>
1313
<string name="block_this_profile">Block this profile</string>
1414
<string name="unblock_this_profile">Unblock this profile</string>
1515
<string name="mute_this_profile">Mute this profile</string>
1616
<string name="unmute_this_profile">Unmute this profile</string>
17-
<string name="load_more">حمّل المزيد</string>
17+
<string name="load_more">تحميل المزيد</string>
1818
<string name="follow">Follow</string>
1919
<string name="unfollow">Unfollow</string>
2020
<string name="followers">Followers</string>

app/src/main/res/values-hu-rHU/strings.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175
<string name="blocked">letiltott</string>
176176
<string name="message">Üzenet</string>
177177
<string name="all">Mind</string>
178-
<string name="likes_">Kedvencek</string>
178+
<string name="likes_">Kedvelések</string>
179179
<string name="reposts">Megosztások</string>
180180
<string name="edit_post">Bejegyzés szerkesztése</string>
181181
<string name="notification_widget_description">Légy naprakész a legfrissebb Pixelfed értesítéseiddel a kezdőképernyőn</string>
@@ -211,5 +211,5 @@
211211
<string name="location">Helyszín</string>
212212
<string name="mentions">Említések</string>
213213
<string name="explore">Felfedezés</string>
214-
<string name="reblogged_by">reblogged by %1$s</string>
214+
<string name="reblogged_by">megosztotta %1$s</string>
215215
</resources>

0 commit comments

Comments
 (0)