mobile: make telemetry opt-in

This commit is contained in:
ammarahm-ed
2023-02-13 16:49:25 +05:00
committed by Abdullah Atta
parent 3611bba1d4
commit 2ab756a847
10 changed files with 19 additions and 50 deletions

View File

@@ -20,7 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import React, { useRef, useState } from "react";
import { Dimensions, View } from "react-native";
import Animated, { FadeInDown, FadeOutUp } from "react-native-reanimated";
import umami from "../../common/analytics";
import { db } from "../../common/database";
import { DDS } from "../../services/device-detection";
import { ToastEvent } from "../../services/event-manager";
@@ -79,7 +78,6 @@ export const Signup = ({ changeMode, trial }) => {
clearMessage();
setEmailVerifyMessage();
hideAuth();
umami.pageView("/account-created", "/welcome/signup");
await sleep(300);
if (trial) {
PremiumService.sheet(null, null, true);

View File

@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React, { useEffect } from "react";
import React from "react";
import {
Dimensions,
Image,
@@ -26,7 +26,6 @@ import {
View
} from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import umami from "../../common/analytics";
import useGlobalSafeAreaInsets from "../../hooks/use-global-safe-area-insets";
import { useNavigationFocus } from "../../hooks/use-navigation-focus";
import { DDS } from "../../services/device-detection";
@@ -50,9 +49,6 @@ export const SVG_Z =
const Intro = ({ navigation }) => {
const colors = useThemeStore((state) => state.colors);
const introCompleted = useSettingStore(
(state) => state.settings.introCompleted
);
const isTelemetryEnabled = useSettingStore(
(state) => state.settings.telemetry
);
@@ -64,12 +60,6 @@ const Intro = ({ navigation }) => {
}
});
useEffect(() => {
if (!introCompleted) {
umami.pageView("/welcome", "", []);
}
}, [introCompleted]);
return (
<View
testID="notesnook.splashscreen"
@@ -171,8 +161,6 @@ const Intro = ({ navigation }) => {
navigation.navigate("AppLock", {
welcome: true
});
umami.pageView("/home", "/welcome");
}}
style={{
paddingHorizontal: 24,

File diff suppressed because one or more lines are too long

View File

@@ -18,9 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React, { useState } from "react";
import { ActivityIndicator, ScrollView, View } from "react-native";
import { ActivityIndicator, Platform, ScrollView, View } from "react-native";
import { LAUNCH_ROCKET } from "../../assets/images/assets";
import umami from "../../common/analytics";
import { db } from "../../common/database";
import { usePricing } from "../../hooks/use-pricing";
import { DDS } from "../../services/device-detection";
@@ -48,7 +47,6 @@ import { Walkthrough } from "../walkthroughs";
import { features } from "./features";
import { Group } from "./group";
import { PricingPlans } from "./pricing-plans";
import { Platform } from "react-native";
export const Component = ({ close, promo }) => {
const colors = useThemeStore((state) => state.colors);
@@ -60,7 +58,6 @@ export const Component = ({ close, promo }) => {
const onPress = async () => {
if (user) {
umami.pageView("/pro-plans", "/pro-screen");
presentSheet({
context: "pricing_plans",
component: (
@@ -69,7 +66,6 @@ export const Component = ({ close, promo }) => {
});
} else {
close();
umami.pageView("/signup", "/pro-screen");
setTimeout(() => {
eSendEvent(eOpenLoginDialog, AuthMode.trialSignup);
}, 400);

View File

@@ -17,10 +17,9 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React, { useEffect, useState } from "react";
import React, { useCallback, useEffect, useState } from "react";
import { ActivityIndicator, Platform, Text, View } from "react-native";
import * as RNIap from "react-native-iap";
import umami from "../../common/analytics";
import { db } from "../../common/database";
import { usePricing } from "../../hooks/use-pricing";
import {
@@ -48,7 +47,6 @@ import Heading from "../ui/typography/heading";
import Paragraph from "../ui/typography/paragraph";
import { Walkthrough } from "../walkthroughs";
import { PricingItem } from "./pricing-item";
import { useCallback } from "react";
const promoCyclesMonthly = {
1: "first month",
@@ -141,10 +139,6 @@ export const PricingPlans = ({
setBuying(false);
return;
}
umami.pageView(
"/iap-native",
`${compact ? "pro-sheet" : "pro-screen"}/pro-plans`
);
await RNIap.requestSubscription(
product?.productId,
false,

View File

@@ -20,7 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import React, { useCallback } from "react";
import { FlatList, View } from "react-native";
import { notesnook } from "../../../e2e/test.ids";
import umami from "../../common/analytics";
import useGlobalSafeAreaInsets from "../../hooks/use-global-safe-area-insets";
import { DDS } from "../../services/device-detection";
import { eSendEvent } from "../../services/event-manager";
@@ -76,7 +75,6 @@ export const SideMenu = React.memo(
name: "Notesnook Pro",
icon: "crown",
func: () => {
umami.pageView("/pro-screen", "/sidemenu");
eSendEvent(eOpenPremiumDialog);
}
};

View File

@@ -28,8 +28,9 @@ import {
NativeEventSubscription
} from "react-native";
import { WebViewMessageEvent } from "react-native-webview";
import umami from "../../../common/analytics/index";
import { db } from "../../../common/database";
import { RelationsList } from "../../../components/sheets/relations-list";
import ReminderSheet from "../../../components/sheets/reminder";
import useKeyboard from "../../../hooks/use-keyboard";
import { DDS } from "../../../services/device-detection";
import {
@@ -53,15 +54,13 @@ import {
eOpenPublishNoteDialog,
eOpenTagsDialog
} from "../../../utils/events";
import { openLinkInBrowser } from "../../../utils/functions";
import { tabBarRef } from "../../../utils/global-refs";
import { NoteType } from "../../../utils/types";
import { useDragState } from "../../settings/editor/state";
import { EventTypes } from "./editor-events";
import { EditorMessage, EditorProps, useEditorType } from "./types";
import { EditorEvents, editorState } from "./utils";
import { openLinkInBrowser } from "../../../utils/functions";
import { EventTypes } from "./editor-events";
import { RelationsList } from "../../../components/sheets/relations-list";
import ReminderSheet from "../../../components/sheets/reminder";
const publishNote = async (editor: useEditorType) => {
const user = useUserStore.getState().user;
@@ -363,7 +362,6 @@ export const useEditorEvents = (
if (editor.state.current?.isFocused) {
editor.state.current.isFocused = true;
}
umami.pageView("/pro-screen", "/editor");
eSendEvent(eOpenPremiumDialog);
break;
case EventTypes.monograph:

View File

@@ -21,7 +21,6 @@ import React, { useState } from "react";
import { Dimensions, LayoutAnimation, Platform, View } from "react-native";
import Animated, { FadeInDown, FadeOutUp } from "react-native-reanimated";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import umami from "../../common/analytics";
import { SVG_Z } from "../../components/intro";
import { WelcomeNotice } from "../../components/intro/welcome";
import { Button } from "../../components/ui/button";
@@ -205,7 +204,6 @@ const AppLock = ({ route }) => {
type: "linear"
}
});
umami.pageView("/privacymode", "/welcome");
setStep(1);
}}
style={{

View File

@@ -17,6 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Platform } from "react-native";
import { verifyUser } from "../screens/settings/functions";
import { useMessageStore } from "../stores/use-message-store";
import {
eOpenLoginDialog,
@@ -25,9 +27,6 @@ import {
} from "../utils/events";
import { eSendEvent } from "./event-manager";
import PremiumService from "./premium";
import { verifyUser } from "../screens/settings/functions";
import { Platform } from "react-native";
import umami from "../common/analytics";
import SettingsService from "./settings";
const rateAppMessage = {
@@ -82,7 +81,6 @@ const loginMessage = {
message: "You are not logged in",
actionText: "Login to encrypt and sync notes",
onPress: () => {
umami.pageView("/signup", "/welcome/home");
eSendEvent(eOpenLoginDialog);
},
data: {},

View File

@@ -19,12 +19,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { Dimensions, PlatformOSType } from "react-native";
import Config from "react-native-config";
import { Sound } from "react-native-notification-sounds";
import { initialWindowMetrics } from "react-native-safe-area-context";
import { FileType } from "react-native-scoped-storage";
import create, { State } from "zustand";
import { ACCENT } from "../utils/color-scheme";
import { initialWindowMetrics } from "react-native-safe-area-context";
import { Reminder } from "../services/notifications";
import { Sound } from "react-native-notification-sounds";
import { ACCENT } from "../utils/color-scheme";
export type Settings = {
showToolbarOnTop?: boolean;
@@ -123,7 +123,7 @@ export const useSettingStore = create<SettingStore>((set) => ({
screenshotMode: true,
privacyScreen: false,
appLockMode: "none",
telemetry: true,
telemetry: false,
notebooksListMode: "normal",
notesListMode: "normal",
devMode: false,