Skip to content

Commit

Permalink
Merge Release 1.32.6
Browse files Browse the repository at this point in the history
  • Loading branch information
sharunkumar committed Dec 30, 2023
2 parents e6a4d99 + addff96 commit 2bfdc4f
Show file tree
Hide file tree
Showing 68 changed files with 368 additions and 280 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 196
versionName "1.32.2"
versionCode 200
versionName "1.32.6"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
Expand Down
4 changes: 2 additions & 2 deletions ios/App/App/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.32.2</string>
<string>1.32.6</string>
<key>CFBundleVersion</key>
<string>196</string>
<string>200</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/App/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 58e6bf0ded6645a085c01ee49d3f74f4341c05c1

COCOAPODS: 1.12.1
COCOAPODS: 1.14.3
2 changes: 1 addition & 1 deletion 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": "1.32.2",
"version": "1.32.6",
"type": "module",
"packageManager": "pnpm@8.11.0+sha256.5858806c3b292cbec89b5533662168a957358e2bbd86431516d441dc1aface89",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/ActorRedirect.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Redirect, useLocation, useParams } from "react-router";
import { useAppSelector } from "./store";
import { jwtIssSelector } from "./features/auth/authSlice";
import { jwtIssSelector } from "./features/auth/authSelectors";
import React from "react";
import useIonViewIsVisible from "./helpers/useIonViewIsVisible";

Expand Down
2 changes: 1 addition & 1 deletion src/AppCrash.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import styled from "@emotion/styled";
import { FallbackProps } from "react-error-boundary";
import { useLocation } from "react-router";
import { useAppSelector } from "./store";
import { jwtSelector } from "./features/auth/authSlice";
import { jwtSelector } from "./features/auth/authSelectors";
import { isInstalled, isNative } from "./helpers/device";
import { IonButton, IonContent, IonIcon, IonLabel } from "@ionic/react";
import { logoGithub } from "ionicons/icons";
Expand Down
13 changes: 5 additions & 8 deletions src/Auth.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import React, { useCallback, useEffect } from "react";
import { useAppDispatch, useAppSelector } from "./store";
import {
getSiteIfNeeded,
isAdminSelector,
jwtIssSelector,
jwtSelector,
updateConnectedInstance,
} from "./features/auth/authSlice";
import { updateConnectedInstance } from "./features/auth/authSlice";
import { useLocation } from "react-router";
import { getInboxCounts, syncMessages } from "./features/inbox/inboxSlice";
import { useInterval } from "usehooks-ts";
Expand All @@ -15,6 +9,8 @@ import { getDefaultServer } from "./services/app";
import { isLemmyError } from "./helpers/lemmy";
import useAppToast from "./helpers/useAppToast";
import BackgroundReportSync from "./features/moderation/BackgroundReportSync";
import { getSiteIfNeeded, isAdminSelector } from "./features/auth/siteSlice";
import { jwtIssSelector, jwtSelector } from "./features/auth/authSelectors";

interface AuthProps {
children: React.ReactNode;
Expand All @@ -30,7 +26,8 @@ export default function Auth({ children }: AuthProps) {
);
const hasModdedSubs = useAppSelector(
(state) =>
!!state.auth.site?.my_user?.moderates.length || !!isAdminSelector(state),
!!state.site.response?.my_user?.moderates.length ||
!!isAdminSelector(state),
);
const location = useLocation();
const pageVisibility = usePageVisibility();
Expand Down
2 changes: 1 addition & 1 deletion src/TabBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
handleSelector,
jwtIssSelector,
jwtSelector,
} from "./features/auth/authSlice";
} from "./features/auth/authSelectors";
import { forwardRef, useContext, useEffect, useMemo } from "react";
import { getDefaultServer } from "./services/app";
import { focusSearchBar } from "./pages/search/SearchPage";
Expand Down
2 changes: 1 addition & 1 deletion src/TabbedRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import PostDetail from "./pages/posts/PostPage";
import CommunitiesPage from "./pages/posts/CommunitiesPage";
import CommunityPage from "./pages/shared/CommunityPage";
import { useAppSelector } from "./store";
import { jwtIssSelector } from "./features/auth/authSlice";
import { jwtIssSelector } from "./features/auth/authSelectors";
import ActorRedirect from "./ActorRedirect";
import SpecialFeedPage from "./pages/shared/SpecialFeedPage";
import UserPage from "./pages/profile/UserPage";
Expand Down
3 changes: 1 addition & 2 deletions src/features/auth/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -402,9 +402,8 @@ function getLoginErrorMessage(error: unknown, instanceActorId: string): string {
case "couldnt_find_person":
return `User not found. Is your account on ${instanceActorId}?`;
case "password_incorrect" as OldLemmyErrorValue:
return "Incorrect password. Please try again.";
case "incorrect_login":
return "Incorrect login credentials. Please try again.";
return `Incorrect login credentials for ${instanceActorId}. Please try again.`;
case "email_not_verified":
return `Email not verified. Please check your inbox. Request a new verification email from https://${instanceActorId}.`;
case "site_ban":
Expand Down
3 changes: 2 additions & 1 deletion src/features/auth/PageContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import React, {
import { CommentReplyItem } from "../comment/compose/reply/CommentReply";
import Login from "../auth/Login";
import { useAppDispatch, useAppSelector } from "../../store";
import { changeAccount, jwtSelector } from "../auth/authSlice";
import { changeAccount } from "../auth/authSlice";
import CommentReplyModal from "../comment/compose/reply/CommentReplyModal";
import { Comment, CommentView, PostView } from "lemmy-js-client";
import CommentEditModal from "../comment/compose/edit/CommentEditModal";
Expand All @@ -22,6 +22,7 @@ import ShareAsImageModal, {
ShareAsImageData,
} from "../share/asImage/ShareAsImageModal";
import AccountSwitcher from "./AccountSwitcher";
import { jwtSelector } from "./authSelectors";

interface IPageContext {
// used for ion presentingElement
Expand Down
44 changes: 44 additions & 0 deletions src/features/auth/authSelectors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { createSelector } from "@reduxjs/toolkit";
import { RootState } from "../../store";
import { parseJWT } from "../../helpers/lemmy";
import { getClient } from "../../services/lemmy";

export const activeAccount = createSelector(
[
(state: RootState) => state.auth.accountData?.accounts,
(state: RootState) => state.auth.accountData?.activeHandle,
],
(accounts, activeHandle) => {
return accounts?.find(({ handle }) => handle === activeHandle);
},
);

export const jwtSelector = createSelector([activeAccount], (account) => {
return account?.jwt;
});

export const jwtPayloadSelector = createSelector([jwtSelector], (jwt) =>
jwt ? parseJWT(jwt) : undefined,
);

export const jwtIssSelector = (state: RootState) =>
jwtPayloadSelector(state)?.iss;

export const handleSelector = createSelector([activeAccount], (account) => {
return account?.handle;
});

export const usernameSelector = createSelector([handleSelector], (handle) => {
return handle?.split("@")[0];
});

export const urlSelector = (state: RootState) =>
jwtIssSelector(state) ?? state.auth.connectedInstance;

export const clientSelector = createSelector(
[urlSelector, jwtSelector],
(url, jwt) => {
// never leak the jwt to the incorrect server
return getClient(url, jwt);
},
);
Loading

0 comments on commit 2bfdc4f

Please sign in to comment.