Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: make recurring reminders pro

ammarahm-edfcc39034c46d
diff --git a/apps/mobile/app/components/list-items/headers/section-header.js b/apps/mobile/app/components/list-items/headers/section-header.js
index 8c3c9bfc4..0e9093a83 100644
--- a/apps/mobile/app/components/list-items/headers/section-header.js
+++ b/apps/mobile/app/components/list-items/headers/section-header.js
@@ -122,7 +122,7 @@ export const SectionHeader = React.memo(
alignItems: "center"
}}
>
- {index === 0 ? (
+ {index === 0 && (
<>
<Button
onPress={() => {
@@ -130,6 +130,7 @@ export const SectionHeader = React.memo(
component: <Sort screen={screen} type={type} />
});
}}
+ hidden={screen === "Reminders"}
tooltipText="Change sorting of items in list"
fwdRef={sortRef}
title={groupBy}
@@ -152,38 +153,35 @@ export const SectionHeader = React.memo(
iconPosition="right"
/>
- {type === "notes" || type === "notebooks" || type === "home" ? (
- <IconButton
- customStyle={{
- width: 25,
- height: 25
- }}
- testID="icon-compact-mode"
- tooltipText={
- listMode == "compact"
- ? "Switch to normal mode"
- : "Switch to compact mode"
- }
- fwdRef={compactModeRef}
- color={colors.icon}
- name={
- listMode == "compact" ? "view-list" : "view-list-outline"
- }
- onPress={() => {
- let settings = {};
- settings[
- type !== "notebooks"
- ? "notesListMode"
- : "notebooksListMode"
- ] = listMode === "normal" ? "compact" : "normal";
+ <IconButton
+ customStyle={{
+ width: 25,
+ height: 25
+ }}
+ hidden={
+ type !== "notes" && type !== "notebooks" && type !== "home"
+ }
+ testID="icon-compact-mode"
+ tooltipText={
+ listMode == "compact"
+ ? "Switch to normal mode"
+ : "Switch to compact mode"
+ }
+ fwdRef={compactModeRef}
+ color={colors.icon}
+ name={listMode == "compact" ? "view-list" : "view-list-outline"}
+ onPress={() => {
+ let settings = {};
+ settings[
+ type !== "notebooks" ? "notesListMode" : "notebooksListMode"
+ ] = listMode === "normal" ? "compact" : "normal";
- SettingsService.set(settings);
- }}
- size={SIZE.lg - 2}
- />
- ) : null}
+ SettingsService.set(settings);
+ }}
+ size={SIZE.lg - 2}
+ />
</>
- ) : null}
+ )}
</View>
</View>
);
diff --git a/apps/mobile/app/components/sheets/reminder/index.tsx b/apps/mobile/app/components/sheets/reminder/index.tsx
index 67865d0e5..1e5690e4e 100644
--- a/apps/mobile/app/components/sheets/reminder/index.tsx
+++ b/apps/mobile/app/components/sheets/reminder/index.tsx
@@ -38,6 +38,7 @@ import Navigation from "../../../services/navigation";
import Notifications, { Reminder } from "../../../services/notifications";
import { useRelationStore } from "../../../stores/use-relation-store";
import Paragraph from "../../ui/typography/paragraph";
+import PremiumService from "../../../services/premium";
type ReminderSheetProps = {
actionSheetRef: RefObject<ActionSheet>;
close?: (ctx?: string) => void;
@@ -254,6 +255,7 @@ export default function ReminderSheet({
borderRadius: 100,
minWidth: 70
}}
+ proTag={mode === "Repeat"}
height={35}
type={
reminderMode === ReminderModes[mode as keyof typeof ReminderModes]
@@ -261,6 +263,7 @@ export default function ReminderSheet({
: "gray"
}
onPress={() => {
+ if (mode === "Repeat" && !PremiumService.get()) return;
setReminderMode(
ReminderModes[
mode as keyof typeof ReminderModes
@@ -287,31 +290,6 @@ export default function ReminderSheet({
alignItems: "center"
}}
>
- {/* {Platform.OS === "android" ? (
- <Input
- containerStyle={{
- width: 40,
- height: 30,
- borderWidth: 0,
- borderBottomWidth: 1,
- borderColor: colors.accent
- }}
- inputStyle={{
- fontFamily: "mono",
- textAlign: "center"
- }}
- onChangeText={(text) => {
- setRepeatFrequency(!text ? 1 : parseInt(text));
- }}
- keyboardType="decimal-pad"
- fontSize={SIZE.sm}
- defaultValue="1"
- height={30}
- marginBottom={0}
- marginRight={0}
- flexGrow={0}
- />
- ) : null} */}
{Object.keys(RecurringModes).map((mode) => (
<Button
key={mode}
diff --git a/apps/mobile/app/components/ui/button/index.tsx b/apps/mobile/app/components/ui/button/index.tsx
index efcb42fd9..1c94c7452 100644
--- a/apps/mobile/app/components/ui/button/index.tsx
+++ b/apps/mobile/app/components/ui/button/index.tsx
@@ -22,13 +22,16 @@ import {
ActivityIndicator,
ColorValue,
TextStyle,
- ViewStyle
+ ViewStyle,
+ View
} from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { ColorKey, useThemeStore } from "../../../stores/use-theme-store";
+import { useUserStore } from "../../../stores/use-user-store";
import { showTooltip, TOOLTIP_POSITIONS } from "../../../utils";
import { BUTTON_TYPES } from "../../../utils/constants";
import { SIZE } from "../../../utils/size";
+import { ProTag } from "../../premium/pro-tag";
import { PressableButton, PressableButtonProps } from "../pressable";
import Heading from "../typography/heading";
import Paragraph from "../typography/paragraph";
@@ -53,6 +56,7 @@ export interface ButtonProps extends PressableButtonProps {
bold?: boolean;
iconColor?: ColorValue;
iconStyle?: TextStyle;
+ proTag?: boolean;
}
export const Button = ({
height = 45,
@@ -76,10 +80,11 @@ export const Button = ({
iconColor,
fwdRef,
iconStyle,
+ proTag,
...restProps
}: ButtonProps) => {
const colors = useThemeStore((state) => state.colors);
-
+ const premium = useUserStore((state) => state.premium);
const textColor = buttonType?.text
? buttonType.text
: (colors[
@@ -152,6 +157,15 @@ export const Button = ({
{title}
</Component>
)}
+ {proTag && !premium ? (
+ <View
+ style={{
+ marginLeft: 10
+ }}
+ >
+ <ProTag size={10} width={40} background={colors.shade} />
+ </View>
+ ) : null}
{icon && !loading && iconPosition === "right" ? (
<Icon
diff --git a/apps/mobile/app/components/ui/pressable/index.tsx b/apps/mobile/app/components/ui/pressable/index.tsx
index d05e1b6d5..b49da191e 100644
--- a/apps/mobile/app/components/ui/pressable/index.tsx
+++ b/apps/mobile/app/components/ui/pressable/index.tsx
@@ -47,6 +47,7 @@ export interface PressableButtonProps extends PressableProps {
customOpacity?: number;
fwdRef?: RefObject<View>;
animatedViewProps?: Animated.AnimateProps<View>;
+ hidden?:boolean
}
export const PressableButton = ({
@@ -65,7 +66,8 @@ export const PressableButton = ({
customSelectedColor,
customAlpha,
customOpacity,
- fwdRef
+ fwdRef,
+ hidden
}: PressableButtonProps) => {
const colors = useThemeStore((state) => state.colors);
@@ -109,7 +111,7 @@ export const PressableButton = ({
[alpha, selectedColor, opacity, primaryColor, noborder, customStyle]
);
- return (
+ return hidden ? null : (
<Pressable
testID={testID}
ref={fwdRef}