Skip to content

Commit

Permalink
Merge Release 2.12.4
Browse files Browse the repository at this point in the history
  • Loading branch information
sharunkumar committed Jun 23, 2024
2 parents 04f43e5 + 24ce22f commit ee0dd47
Show file tree
Hide file tree
Showing 17 changed files with 141 additions and 106 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "app.vger.voyager"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 251
versionName "2.12.1"
versionCode 254
versionName "2.12.4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
Expand Down
2 changes: 1 addition & 1 deletion android/capacitor.settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ include ':capacitor-plugin-safe-area'
project(':capacitor-plugin-safe-area').projectDir = new File('../node_modules/.pnpm/capacitor-plugin-safe-area@3.0.1_@capacitor+core@6.0.0/node_modules/capacitor-plugin-safe-area/android')

include ':capacitor-stash-media'
project(':capacitor-stash-media').projectDir = new File('../node_modules/.pnpm/capacitor-stash-media@2.0.0_@capacitor+core@6.0.0/node_modules/capacitor-stash-media/android')
project(':capacitor-stash-media').projectDir = new File('../node_modules/.pnpm/capacitor-stash-media@2.0.1_@capacitor+core@6.0.0/node_modules/capacitor-stash-media/android')

include ':capacitor-tips'
project(':capacitor-tips').projectDir = new File('../node_modules/.pnpm/capacitor-tips@1.0.0_@capacitor+core@6.0.0/node_modules/capacitor-tips/android')
4 changes: 2 additions & 2 deletions ios/App/App/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.12.1</string>
<string>2.12.4</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand All @@ -32,7 +32,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>251</string>
<string>254</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/App/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def capacitor_pods
pod 'CapacitorClearCache', :path => '../../node_modules/.pnpm/capacitor-clear-cache@1.0.1_@capacitor+core@6.0.0/node_modules/capacitor-clear-cache'
pod 'CapacitorLaunchNative', :path => '../../node_modules/.pnpm/capacitor-launch-native@1.0.0_@capacitor+core@6.0.0/node_modules/capacitor-launch-native'
pod 'CapacitorPluginSafeArea', :path => '../../node_modules/.pnpm/capacitor-plugin-safe-area@3.0.1_@capacitor+core@6.0.0/node_modules/capacitor-plugin-safe-area'
pod 'CapacitorStashMedia', :path => '../../node_modules/.pnpm/capacitor-stash-media@2.0.0_@capacitor+core@6.0.0/node_modules/capacitor-stash-media'
pod 'CapacitorStashMedia', :path => '../../node_modules/.pnpm/capacitor-stash-media@2.0.1_@capacitor+core@6.0.0/node_modules/capacitor-stash-media'
pod 'CapacitorTips', :path => '../../node_modules/.pnpm/capacitor-tips@1.0.0_@capacitor+core@6.0.0/node_modules/capacitor-tips'
end

Expand Down
10 changes: 5 additions & 5 deletions ios/App/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ PODS:
- Capacitor
- CapacitorShare (6.0.0):
- Capacitor
- CapacitorStashMedia (2.0.0):
- CapacitorStashMedia (2.0.1):
- Capacitor
- SDWebImage
- CapacitorStatusBar (6.0.0):
Expand Down Expand Up @@ -58,7 +58,7 @@ DEPENDENCIES:
- "CapacitorNetwork (from `../../node_modules/.pnpm/@capacitor+network@6.0.0_@capacitor+core@6.0.0/node_modules/@capacitor/network`)"
- "CapacitorPluginSafeArea (from `../../node_modules/.pnpm/capacitor-plugin-safe-area@3.0.1_@capacitor+core@6.0.0/node_modules/capacitor-plugin-safe-area`)"
- "CapacitorShare (from `../../node_modules/.pnpm/@capacitor+share@6.0.0_@capacitor+core@6.0.0/node_modules/@capacitor/share`)"
- "CapacitorStashMedia (from `../../node_modules/.pnpm/capacitor-stash-media@2.0.0_@capacitor+core@6.0.0/node_modules/capacitor-stash-media`)"
- "CapacitorStashMedia (from `../../node_modules/.pnpm/capacitor-stash-media@2.0.1_@capacitor+core@6.0.0/node_modules/capacitor-stash-media`)"
- "CapacitorStatusBar (from `../../node_modules/.pnpm/@capacitor+status-bar@6.0.0_@capacitor+core@6.0.0/node_modules/@capacitor/status-bar`)"
- "CapacitorTips (from `../../node_modules/.pnpm/capacitor-tips@1.0.0_@capacitor+core@6.0.0/node_modules/capacitor-tips`)"

Expand Down Expand Up @@ -100,7 +100,7 @@ EXTERNAL SOURCES:
CapacitorShare:
:path: "../../node_modules/.pnpm/@capacitor+share@6.0.0_@capacitor+core@6.0.0/node_modules/@capacitor/share"
CapacitorStashMedia:
:path: "../../node_modules/.pnpm/capacitor-stash-media@2.0.0_@capacitor+core@6.0.0/node_modules/capacitor-stash-media"
:path: "../../node_modules/.pnpm/capacitor-stash-media@2.0.1_@capacitor+core@6.0.0/node_modules/capacitor-stash-media"
CapacitorStatusBar:
:path: "../../node_modules/.pnpm/@capacitor+status-bar@6.0.0_@capacitor+core@6.0.0/node_modules/@capacitor/status-bar"
CapacitorTips:
Expand All @@ -123,11 +123,11 @@ SPEC CHECKSUMS:
CapacitorNetwork: f15a94c16a33cba7c47a17814cb6bcfe3ea34ded
CapacitorPluginSafeArea: b99681e1d9986ae1c059ca0e1b5e7025916e5e04
CapacitorShare: a771200d3b924a5d7ad9d9fecbac517e4c0aa74f
CapacitorStashMedia: a9038a69ab186f5d172536791887ef67fb2a39f8
CapacitorStashMedia: 10aa96dc5f874c4c27642528a4c327c46792abf2
CapacitorStatusBar: 2e4369f99166125435641b1908d05f561eaba6f6
CapacitorTips: 2087733aea06ec041b210085395ca934c8554907
SDWebImage: 750adf017a315a280c60fde706ab1e552a3ae4e9

PODFILE CHECKSUM: 91325504efbeb1b038121b8724e8025b9f2fa11f
PODFILE CHECKSUM: 28718eb4e9f122216fc11cbe2c95ad57524fee30

COCOAPODS: 1.12.1
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "voyager",
"description": "A progressive webapp Lemmy client",
"private": true,
"version": "2.12.1",
"version": "2.12.4",
"type": "module",
"packageManager": "pnpm@9.1.4+sha512.9df9cf27c91715646c7d675d1c9c8e41f6fce88246f1318c1aa6a1ed1aeb3c4f032fcdf4ba63cc69c4fe6d634279176b5358727d8f2cc1e65b65f43ce2f8bfb0",
"scripts": {
Expand Down Expand Up @@ -59,7 +59,7 @@
"capacitor-launch-native": "^1.0.0",
"capacitor-plugin-safe-area": "^3.0.1",
"capacitor-set-version": "^2.2.0",
"capacitor-stash-media": "^2.0.0",
"capacitor-stash-media": "^2.0.1",
"capacitor-tips": "^1.0.0",
"compare-versions": "^6.1.0",
"date-fns": "^3.6.0",
Expand Down
24 changes: 8 additions & 16 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 3 additions & 26 deletions src/core/Auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { getInboxCounts, syncMessages } from "../features/inbox/inboxSlice";
import { useInterval } from "usehooks-ts";
import usePageVisibility from "../helpers/usePageVisibility";
import { getDefaultServer } from "../services/app";
import { isLemmyError } from "../helpers/lemmyErrors";
import useAppToast from "../helpers/useAppToast";
import BackgroundReportSync from "../features/moderation/BackgroundReportSync";
import { getSiteIfNeeded, isAdminSelector } from "../features/auth/siteSlice";
import { instanceSelector, jwtSelector } from "../features/auth/authSelectors";
Expand Down Expand Up @@ -42,7 +40,6 @@ function AuthLocation() {
const location = useLocation();

const dispatch = useAppDispatch();
const presentToast = useAppToast();
const pageVisibility = usePageVisibility();
const jwt = useAppSelector(jwtSelector);

Expand Down Expand Up @@ -82,26 +79,6 @@ function AuthLocation() {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [location.pathname]);

const getInboxCountsAndErrorIfNeeded = useCallback(async () => {
try {
await dispatch(getInboxCounts());
} catch (error) {
if (
isLemmyError(error, "not_logged_in") ||
isLemmyError(error, "incorrect_login")
) {
presentToast({
message: "Logged out by Lemmy instance. Please try logging in again.",
color: "warning",
duration: 4_000,
});
}

throw error;
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [dispatch]);

useInterval(
() => {
if (!pageVisibility) return;
Expand All @@ -116,14 +93,14 @@ function AuthLocation() {
if (!pageVisibility) return;
if (!jwt) return;

getInboxCountsAndErrorIfNeeded();
dispatch(getInboxCounts());
}, 1_000 * 60);

useEffect(() => {
if (!pageVisibility) return;

getInboxCountsAndErrorIfNeeded();
}, [pageVisibility, jwt, getInboxCountsAndErrorIfNeeded]);
dispatch(getInboxCounts());
}, [pageVisibility, jwt, dispatch]);

useEffect(() => {
if (!pageVisibility) return;
Expand Down
18 changes: 9 additions & 9 deletions src/features/auth/login/login/PickLoginServer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,22 @@ export default function PickLoginServer() {
async function submit() {
if (loading) return;

setLoading(true);

const potentialServer = searchHostname.toLowerCase();

// Dirty input with candidate
if (instances[0] && search !== potentialServer) {
setDirty(false);
setSearch(instances[0]);
return;
}

setLoading(true);

let site: GetSiteResponse;

try {
site = await getClient(potentialServer).getSite();
} catch (error) {
// Dirty input with candidate
if (instances[0]) {
setDirty(false);
setSearch(instances[0]);
return;
}

presentToast({
message: `Problem connecting to ${potentialServer}. Please try again`,
color: "danger",
Expand Down
2 changes: 1 addition & 1 deletion src/features/comment/useCommentActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export default function useCommentActions({
handler: () => {
(async () => {
if (presentLoginIfNeeded()) return;
if (commentView.post.locked) {
if (commentView.post.locked && !canModerate) {
presentToast(postLocked);
return;
}
Expand Down
34 changes: 2 additions & 32 deletions src/features/inbox/inboxSlice.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import { PayloadAction, createSelector, createSlice } from "@reduxjs/toolkit";
import { GetUnreadCountResponse, PrivateMessageView } from "lemmy-js-client";
import { AppDispatch, RootState } from "../../store";
import { logoutAccount } from "../auth/authSlice";
import { InboxItemView } from "./InboxItem";
import { differenceBy, groupBy, sortBy, uniqBy } from "lodash";
import { receivedUsers } from "../user/userSlice";
import { isLemmyError } from "../../helpers/lemmyErrors";
import {
clientSelector,
userHandleSelector,
jwtSelector,
} from "../auth/authSelectors";
import { clientSelector, jwtSelector } from "../auth/authSelectors";

interface PostState {
counts: {
Expand Down Expand Up @@ -118,31 +112,7 @@ export const getInboxCounts =

if (Date.now() - lastUpdatedCounts < 3_000) return;

let result;
const initialHandle = userHandleSelector(getState());

try {
result = await clientSelector(getState()).getUnreadCount();
} catch (error) {
// Get inbox counts is a good place to check if token is valid,
// because it runs quite often (when returning from background,
// every 60 seconds, etc)
//
// If API rejects jwt, check if initial handle used to make the request
// is the same as the handle at this moment (e.g. something else didn't
// log the user out). If match, then proceed to log the user out
if (
isLemmyError(error, "not_logged_in") ||
isLemmyError(error, "incorrect_login")
) {
const handle = userHandleSelector(getState());
if (handle && handle === initialHandle) {
dispatch(logoutAccount(handle));
}
}

throw error;
}
const result = await clientSelector(getState()).getUnreadCount();

if (result) dispatch(receivedInboxCounts(result));
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export default function CreateCrosspostDialog({
name: title,
url: post.post.url,
nsfw: post.post.nsfw,
body: buildCrosspostBody(post.post),
body: buildCrosspostBody(post.post, title !== post.post.name),
community_id: community.community.id,
});
} catch (error) {
Expand Down
6 changes: 5 additions & 1 deletion src/features/post/detail/PostHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import AnimateHeight from "react-animate-height";
import useIsPostUrlMedia from "../useIsPostUrlMedia";
import { findIonContentScrollView } from "../../../helpers/ionic";
import PostLink from "../link/PostLink";
import { getCanModerate } from "../../moderation/useCanModerate";

const BorderlessIonItem = styled(IonItem)`
--padding-start: 0;
Expand Down Expand Up @@ -283,7 +284,10 @@ function PostHeader({
post={post}
onReply={async () => {
if (presentLoginIfNeeded()) return;
if (post.post.locked) {

const canModerate = getCanModerate(post.community);

if (post.post.locked && !canModerate) {
presentToast(postLocked);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/features/post/shared/usePostActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export default function usePostActions(post: PostView) {
icon: arrowUndoOutline,
handler: () => {
if (presentLoginIfNeeded()) return;
if (post.post.locked) {
if (post.post.locked && !canModerate) {
presentToast(postLocked);
return;
}
Expand Down
6 changes: 4 additions & 2 deletions src/features/shared/sliding/BaseSlidingVote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,20 +172,22 @@ function BaseSlidingVoteInternal({

if (isInboxItem(item)) dispatch(markRead(item, true));

const canModerate = getCanModerate(item.community);

// Prevent replying to a comment that's been deleted, or removed by mod (if you're not a mod)
if (!isPost) {
const comment =
store.getState().comment.commentById[item.comment.id] ?? item.comment;

const stub = isStubComment(comment, getCanModerate(item.community));
const stub = isStubComment(comment, canModerate);

if (stub) {
presentToast(replyStubError);
return;
}
}

if (item.post.locked) {
if (item.post.locked && !canModerate) {
presentToast(postLocked);
return;
}
Expand Down
Loading

0 comments on commit ee0dd47

Please sign in to comment.