forked from Kieran/snort
Compare commits
2 Commits
2e4471cee6
...
a141faa2f9
Author | SHA1 | Date | |
---|---|---|---|
a141faa2f9 | |||
afe34294c4 |
@ -197,6 +197,9 @@ export default function NoteFooter(props: NoteFooterProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function tipButton() {
|
function tipButton() {
|
||||||
|
if(prefs.lowDataMode){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
const targets = getZapTarget();
|
const targets = getZapTarget();
|
||||||
if (targets) {
|
if (targets) {
|
||||||
return (
|
return (
|
||||||
@ -214,7 +217,12 @@ export default function NoteFooter(props: NoteFooterProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function repostIcon() {
|
function repostIcon() {
|
||||||
if (readonly) return;
|
if (readonly) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if(prefs.lowDataMode){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<Menu
|
<Menu
|
||||||
menuButton={
|
menuButton={
|
||||||
@ -254,7 +262,7 @@ export default function NoteFooter(props: NoteFooterProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function reactionIcon() {
|
function reactionIcon() {
|
||||||
if (!prefs.enableReactions) {
|
if (!prefs.enableReactions || prefs.lowDataMode){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const reacted = hasReacted("+");
|
const reacted = hasReacted("+");
|
||||||
|
@ -25,7 +25,7 @@ export default function RevealMedia(props: RevealMediaProps) {
|
|||||||
const isMine = props.creator === publicKey;
|
const isMine = props.creator === publicKey;
|
||||||
const hideMedia = preferences.autoLoadMedia === "none" || (!isMine && hideNonFollows);
|
const hideMedia = preferences.autoLoadMedia === "none" || (!isMine && hideNonFollows);
|
||||||
const hostname = new URL(props.link).hostname;
|
const hostname = new URL(props.link).hostname;
|
||||||
|
const lowDataMode = preferences.lowDataMode;
|
||||||
const url = new URL(props.link);
|
const url = new URL(props.link);
|
||||||
const extension = FileExtensionRegex.test(url.pathname.toLowerCase()) && RegExp.$1;
|
const extension = FileExtensionRegex.test(url.pathname.toLowerCase()) && RegExp.$1;
|
||||||
const type = (() => {
|
const type = (() => {
|
||||||
@ -76,7 +76,29 @@ export default function RevealMedia(props: RevealMediaProps) {
|
|||||||
/>
|
/>
|
||||||
</Reveal>
|
</Reveal>
|
||||||
);
|
);
|
||||||
} else {
|
} else if(lowDataMode) {
|
||||||
|
return (
|
||||||
|
<Reveal
|
||||||
|
message={
|
||||||
|
<FormattedMessage
|
||||||
|
defaultMessage="Images will not be loaded automatically in low data mode, update <a><i>your preference</i></a> to show media as per your media preference."
|
||||||
|
id="VfHIx1"
|
||||||
|
values={{
|
||||||
|
i: i => <i>{i}</i>,
|
||||||
|
a: a => <Link to="/settings/preferences">{a}</Link>,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
}>
|
||||||
|
<MediaElement
|
||||||
|
mime={`${type}/${extension}`}
|
||||||
|
url={url.toString()}
|
||||||
|
onMediaClick={props.onMediaClick}
|
||||||
|
meta={props.meta}
|
||||||
|
/>
|
||||||
|
</Reveal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else{
|
||||||
return (
|
return (
|
||||||
<MediaElement
|
<MediaElement
|
||||||
mime={`${type}/${extension}`}
|
mime={`${type}/${extension}`}
|
||||||
|
@ -96,6 +96,11 @@ export interface UserPreferences {
|
|||||||
* Auto-translate when available
|
* Auto-translate when available
|
||||||
*/
|
*/
|
||||||
autoTranslate?: boolean;
|
autoTranslate?: boolean;
|
||||||
|
/**
|
||||||
|
* Low Data mode - images/reactions wont be loaded
|
||||||
|
*/
|
||||||
|
lowDataMode: boolean;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DefaultPreferences = {
|
export const DefaultPreferences = {
|
||||||
@ -116,4 +121,5 @@ export const DefaultPreferences = {
|
|||||||
showStatus: true,
|
showStatus: true,
|
||||||
checkSigs: true,
|
checkSigs: true,
|
||||||
autoTranslate: true,
|
autoTranslate: true,
|
||||||
|
lowDataMode: false
|
||||||
} as UserPreferences;
|
} as UserPreferences;
|
||||||
|
@ -497,6 +497,23 @@ const PreferencesPage = () => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="flex justify-between">
|
||||||
|
<div className="flex flex-col g8">
|
||||||
|
<h4>
|
||||||
|
<FormattedMessage {...messages.LowDataMode} />
|
||||||
|
</h4>
|
||||||
|
<small>
|
||||||
|
<FormattedMessage {...messages.LowDataModeHelp} />
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
checked={perf.lowDataMode}
|
||||||
|
onChange={e => updatePreferences(id, { ...perf, lowDataMode: e.target.checked })}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -76,4 +76,9 @@ export default defineMessages({
|
|||||||
ServiceWorkerNotRunning: { defaultMessage: "Service Worker Not Running", id: "RDha9y" },
|
ServiceWorkerNotRunning: { defaultMessage: "Service Worker Not Running", id: "RDha9y" },
|
||||||
SubscribedToPush: { defaultMessage: "Subscribed to Push", id: "G3A56c" },
|
SubscribedToPush: { defaultMessage: "Subscribed to Push", id: "G3A56c" },
|
||||||
NotSubscribedToPush: { defaultMessage: "Not Subscribed to Push", id: "d2ebEu" },
|
NotSubscribedToPush: { defaultMessage: "Not Subscribed to Push", id: "d2ebEu" },
|
||||||
|
LowDataMode: { defaultMessage: "Low Data Mode", id: '87tg/I' },
|
||||||
|
LowDataModeHelp: {
|
||||||
|
defaultMessage: "Reactions will not be shown on timeline and images would not load automatically",
|
||||||
|
id: 'Qie1Ef',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user