Reduce app size (fonts and model/taxonomy assets) (#1513)

* Remove material community icons

* Remove unneeded font files from app

* Show app size in Debug on Android

* Update snapshots

* Code cleanup
This commit is contained in:
Amanda Bullington
2024-05-08 09:22:01 -07:00
committed by GitHub
parent ea6539e35a
commit e19221ddf0
29 changed files with 197 additions and 245 deletions

View File

@@ -16,7 +16,7 @@ apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.grad
// add vector icons to project
project.ext.vectoricons = [
iconFontNames: [ 'MaterialCommunityIcons.ttf', 'MaterialIcons.ttf' ]
iconFontNames: []
]
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

View File

Binary file not shown.

View File

Binary file not shown.

View File

@@ -3,7 +3,7 @@
"data": [
{
"path": "assets/fonts/INatIcon.ttf",
"sha1": "efff2cbb4d311b22384cfade07cdd4e7ab8516b0"
"sha1": "a668337350732e29a114b5357b5a3a22c17bb7a6"
},
{
"path": "assets/fonts/Lato-Bold.ttf",
@@ -28,10 +28,6 @@
{
"path": "assets/fonts/Lato-Regular.ttf",
"sha1": "f59f9e4f3cbee981a5e6f58a279f9b9613f22599"
},
{
"path": "assets/fonts/inaturalisticons.ttf",
"sha1": "177ae18eacc4a277489677b4abdc441b4487df13"
}
]
}

View File

Binary file not shown.

View File

Binary file not shown.

View File

@@ -25,9 +25,9 @@ PODS:
- hermes-engine/Pre-built (= 0.73.7)
- hermes-engine/Pre-built (0.73.7)
- libevent (2.1.12)
- MMKV (1.3.4):
- MMKVCore (~> 1.3.4)
- MMKVCore (1.3.4)
- MMKV (1.3.5):
- MMKVCore (~> 1.3.5)
- MMKVCore (1.3.5)
- RCT-Folly (2022.05.16.00):
- boost
- DoubleConversion
@@ -1480,8 +1480,8 @@ SPEC CHECKSUMS:
glog: c5d68082e772fa1c511173d6b30a9de2c05a69a2
hermes-engine: 39589e9c297d024e90fe68f6830ff86c4e01498a
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
MMKV: ed58ad794b3f88c24d604a5b74f3fba17fcbaf74
MMKVCore: a67a1cede26175c413176f404a7cedec43f96a0b
MMKV: 506311d0494023c2f7e0b62cc1f31b7370fa3cfb
MMKVCore: 9e2e5fd529b64a9fe15f1a7afb3d73b2e27b4db9
RCT-Folly: 7169b2b1c44399c76a47b5deaaba715eeeb476c0
RCTRequired: 77f73950d15b8c1a2b48ba5b79020c3003d1c9b5
RCTTypeSafety: ede1e2576424d89471ef553b2aed09fbbcc038e3

View File

@@ -9,8 +9,8 @@
/* Begin PBXBuildFile section */
00E356F31AD99517003FC87E /* iNaturalistReactNativeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* iNaturalistReactNativeTests.m */; };
03BE06B8FED98F5CD10273BB /* libPods-iNaturalistReactNative.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 20043186B311EE211FEB259A /* libPods-iNaturalistReactNative.a */; };
08387561362A4099A1D58774 /* INatIcon.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 121B82B7918941189871CFD5 /* INatIcon.ttf */; };
085DD3205807404CAFC32228 /* Lato-Medium.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 3A9BAF07FCF24F668E2EF5AB /* Lato-Medium.ttf */; };
0928C25974EC489BA89D9E45 /* INatIcon.ttf in Resources */ = {isa = PBXBuildFile; fileRef = E5BA7B171CE84F61B07BAAF3 /* INatIcon.ttf */; };
13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.mm */; };
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
@@ -18,7 +18,6 @@
197A169D2A7C2567001A03DC /* cvmodel.mlmodel in Sources */ = {isa = PBXBuildFile; fileRef = 197A169B2A7C2567001A03DC /* cvmodel.mlmodel */; };
197A169E2A7C2567001A03DC /* taxonomy.json in Resources */ = {isa = PBXBuildFile; fileRef = 197A169C2A7C2567001A03DC /* taxonomy.json */; };
3DE2C0F71E184822B561A1ED /* Lato-Italic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 3A54425709BB4844AFBC680D /* Lato-Italic.ttf */; };
4FB3B444D46A4115B867B9CC /* inaturalisticons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = EE004FD2EC174086A7AB2908 /* inaturalisticons.ttf */; };
54EB1EFEC1F74152902EED02 /* Lato-BoldItalic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 8C2D97D72EED451C887998A8 /* Lato-BoldItalic.ttf */; };
5A8D64AB921678B40E0229C8 /* BuildFile in Frameworks */ = {isa = PBXBuildFile; };
725BA058C5384A9185E8036A /* Lato-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 00752F4ADC554701A45A848A /* Lato-Bold.ttf */; };
@@ -70,7 +69,6 @@
00E356EE1AD99517003FC87E /* iNaturalistReactNativeTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = iNaturalistReactNativeTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
00E356F21AD99517003FC87E /* iNaturalistReactNativeTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = iNaturalistReactNativeTests.m; sourceTree = "<group>"; };
121B82B7918941189871CFD5 /* INatIcon.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = INatIcon.ttf; path = ../assets/fonts/INatIcon.ttf; sourceTree = "<group>"; };
13B07F961A680F5B00A75B9A /* iNaturalistReactNative.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iNaturalistReactNative.app; sourceTree = BUILT_PRODUCTS_DIR; };
13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = iNaturalistReactNative/AppDelegate.h; sourceTree = "<group>"; };
13B07FB01A68108700A75B9A /* AppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AppDelegate.mm; path = iNaturalistReactNative/AppDelegate.mm; sourceTree = "<group>"; };
@@ -102,8 +100,8 @@
B8FC28F6DD66FAD52B79E072 /* Pods-iNaturalistReactNative.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iNaturalistReactNative.debug.xcconfig"; path = "Target Support Files/Pods-iNaturalistReactNative/Pods-iNaturalistReactNative.debug.xcconfig"; sourceTree = "<group>"; };
D7AE5BDBC584A83878A04344 /* Pods-iNaturalistReactNative-ShareExtension.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iNaturalistReactNative-ShareExtension.debug.xcconfig"; path = "Target Support Files/Pods-iNaturalistReactNative-ShareExtension/Pods-iNaturalistReactNative-ShareExtension.debug.xcconfig"; sourceTree = "<group>"; };
D8663889EABFBFC3077401E3 /* Pods-iNaturalistReactNative-ShareExtension.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iNaturalistReactNative-ShareExtension.release.xcconfig"; path = "Target Support Files/Pods-iNaturalistReactNative-ShareExtension/Pods-iNaturalistReactNative-ShareExtension.release.xcconfig"; sourceTree = "<group>"; };
E5BA7B171CE84F61B07BAAF3 /* INatIcon.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = INatIcon.ttf; path = ../assets/fonts/INatIcon.ttf; sourceTree = "<group>"; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
EE004FD2EC174086A7AB2908 /* inaturalisticons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = inaturalisticons.ttf; path = ../assets/fonts/inaturalisticons.ttf; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -249,14 +247,13 @@
E7A0E0AA690545D78AA7CC73 /* Resources */ = {
isa = PBXGroup;
children = (
EE004FD2EC174086A7AB2908 /* inaturalisticons.ttf */,
121B82B7918941189871CFD5 /* INatIcon.ttf */,
00752F4ADC554701A45A848A /* Lato-Bold.ttf */,
8C2D97D72EED451C887998A8 /* Lato-BoldItalic.ttf */,
3A54425709BB4844AFBC680D /* Lato-Italic.ttf */,
3A9BAF07FCF24F668E2EF5AB /* Lato-Medium.ttf */,
69DF855D92EA4ADFB73B47F1 /* Lato-MediumItalic.ttf */,
4B0AEEF6CA584BCF9880EB35 /* Lato-Regular.ttf */,
E5BA7B171CE84F61B07BAAF3 /* INatIcon.ttf */,
);
name = Resources;
sourceTree = "<group>";
@@ -384,14 +381,13 @@
1956B4912A7C3C1E00BBBDE4 /* link-inat-model-files.sh in Resources */,
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
8F1AC6772BC1B610002F994B /* PrivacyInfo.xcprivacy in Resources */,
4FB3B444D46A4115B867B9CC /* inaturalisticons.ttf in Resources */,
08387561362A4099A1D58774 /* INatIcon.ttf in Resources */,
725BA058C5384A9185E8036A /* Lato-Bold.ttf in Resources */,
54EB1EFEC1F74152902EED02 /* Lato-BoldItalic.ttf in Resources */,
3DE2C0F71E184822B561A1ED /* Lato-Italic.ttf in Resources */,
085DD3205807404CAFC32228 /* Lato-Medium.ttf in Resources */,
E5DFC1C6FBFA45739CE91C69 /* Lato-MediumItalic.ttf in Resources */,
AE4DC81B3A87484CB3FD6750 /* Lato-Regular.ttf in Resources */,
0928C25974EC489BA89D9E45 /* INatIcon.ttf in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@@ -67,16 +67,13 @@
<string>Export and import ${PRODUCT_NAME} photos to and from your library.</string>
<key>UIAppFonts</key>
<array>
<string>MaterialCommunityIcons.ttf</string>
<string>MaterialIcons.ttf</string>
<string>inaturalisticons.ttf</string>
<string>INatIcon.ttf</string>
<string>Lato-Bold.ttf</string>
<string>Lato-BoldItalic.ttf</string>
<string>Lato-Italic.ttf</string>
<string>Lato-Medium.ttf</string>
<string>Lato-MediumItalic.ttf</string>
<string>Lato-Regular.ttf</string>
<string>INatIcon.ttf</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>

View File

Binary file not shown.

View File

@@ -3,7 +3,7 @@
"data": [
{
"path": "assets/fonts/INatIcon.ttf",
"sha1": "efff2cbb4d311b22384cfade07cdd4e7ab8516b0"
"sha1": "a668337350732e29a114b5357b5a3a22c17bb7a6"
},
{
"path": "assets/fonts/Lato-Bold.ttf",
@@ -28,10 +28,6 @@
{
"path": "assets/fonts/Lato-Regular.ttf",
"sha1": "f59f9e4f3cbee981a5e6f58a279f9b9613f22599"
},
{
"path": "assets/fonts/inaturalisticons.ttf",
"sha1": "177ae18eacc4a277489677b4abdc441b4487df13"
}
]
}

View File

@@ -1,5 +1,6 @@
import { useNavigation } from "@react-navigation/native";
import {
Button,
Heading4,
INatIconButton,
ScrollViewWrapper
@@ -16,7 +17,6 @@ import React, {
useState
} from "react";
import { Platform, Text } from "react-native";
import IconMaterial from "react-native-vector-icons/MaterialIcons";
import useLogs from "sharedHooks/useLogs";
/* eslint-disable i18next/no-literal-string */
@@ -37,13 +37,10 @@ const Log = (): Node => {
/>
</View>
) }
<IconMaterial
name="mail"
size={24}
<Button
className="p-2"
onPress={emailLogFile}
accessibilityLabel="Email logs"
accessibilityHint="Opens email app"
color="white"
text="Email log"
/>
</>
), [emailLogFile, shareLogFile] );

View File

@@ -1,5 +1,6 @@
import _ from "lodash";
import { useEffect, useState } from "react";
import { Platform } from "react-native";
import RNFS from "react-native-fs";
// https://stackoverflow.com/questions/15900485/correct-way-to-convert-size-in-bytes-to-kb-mb-gb-in-javascript
@@ -20,11 +21,7 @@ export function formatSizeUnits( bytes ) {
return bytes;
}
export const directories = [
{
path: RNFS.MainBundlePath,
directoryName: "MainBundle"
},
const sharedDirectories = [
{
path: RNFS.DocumentDirectoryPath,
directoryName: "DocumentDirectory"
@@ -36,12 +33,39 @@ export const directories = [
{
path: RNFS.TemporaryDirectoryPath,
directoryName: "TemporaryDirectory"
}, {
}
];
const iOSDirectories = [
{
path: RNFS.MainBundlePath,
directoryName: "MainBundle"
},
{
path: RNFS.LibraryDirectoryPath,
directoryName: "LibraryDirectory"
}
];
const androidDirectories = [
{
path: RNFS.DownloadDirectoryPath,
directoryName: "DownloadDirectory"
},
{
path: RNFS.ExternalDirectoryPath,
directoryName: "ExternalDirectory"
},
{
path: RNFS.ExternalStorageDirectoryPath,
directoryName: "ExternalStorageDirectory"
}
];
export const directories = Platform.OS === "android"
? sharedDirectories.concat( androidDirectories )
: iOSDirectories.concat( sharedDirectories );
export function formatAppSizeString( name, size ) {
return `${name}: ${formatSizeUnits( size )}`;
}

View File

@@ -1,6 +1,7 @@
// @flow
import createFlag from "api/flags";
import {
BackButton,
Body1, Body3, Button, Checkbox, Subheading1
} from "components/SharedComponents";
import {
@@ -17,7 +18,6 @@ import {
} from "react-native";
import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
import { TextInput } from "react-native-paper";
import IconMaterial from "react-native-vector-icons/MaterialIcons";
import useAuthenticatedMutation from "sharedHooks/useAuthenticatedMutation";
type Props = {
@@ -103,7 +103,7 @@ const FlagItemModal = ( {
>
<SafeAreaView className="flex-1">
<View className="flex-row-reverse justify-between p-6 border-b">
<IconMaterial name="close" onPress={closeFlagItemModal} size={30} />
<BackButton onPress={closeFlagItemModal} />
<Subheading1 className="text-xl">
{t( "Flag-An-Item" )}
</Subheading1>

View File

@@ -1,117 +1,117 @@
{
"add-comment-outline": 61697,
"arcamera": 61698,
"arrow-down-bold-circle-outline": 61699,
"arrow-down-bold-circle": 61700,
"arrow-turn-down-right": 61701,
"arrow-up-bold-circle-outline": 61702,
"arrow-up-bold-circle": 61703,
"arrow-up-circle-dots": 61704,
"arrow-up-small": 61705,
"arrow-up": 61706,
"ban": 61707,
"binoculars": 61708,
"book": 61709,
"briefcase": 61710,
"camera": 61711,
"caret": 61712,
"check": 61713,
"checkmark-circle-outline": 61714,
"checkmark-circle": 61715,
"chevron-left-circle": 61716,
"chevron-left": 61717,
"chevron-right-circle": 61718,
"circle-dots": 61719,
"clock-outline": 61720,
"close-bold": 61721,
"close": 61722,
"comments-outline": 61723,
"comments": 61724,
"compass-rose-outline": 61725,
"copy": 61726,
"copyright": 61727,
"creative-commons": 61728,
"crop": 61729,
"currentlocation": 61730,
"door-exit": 61731,
"edit-comment": 61732,
"flag": 61733,
"flash-off": 61734,
"flash-on": 61735,
"flip": 61736,
"gallery": 61737,
"gear": 61738,
"globe-outline": 61739,
"grid-square": 61740,
"grid": 61741,
"hamburger-menu": 61742,
"heart": 61743,
"help-circle-outline": 61744,
"help-circle": 61745,
"help": 61746,
"iconic-actinopterygii": 61747,
"iconic-amphibia": 61748,
"iconic-animalia": 61749,
"iconic-arachnida": 61750,
"iconic-aves": 61751,
"iconic-chromista": 61752,
"iconic-fungi": 61753,
"triangle-exclamation": 61697,
"trash": 61698,
"trash-outline": 61699,
"stop": 61700,
"star": 61701,
"star-bold-outline": 61702,
"sparkly-label": 61703,
"sounds": 61704,
"sound-outline": 61705,
"sound-bold-outline": 61706,
"sliders": 61707,
"share": 61708,
"rotate": 61709,
"rotate-right": 61710,
"rotate-exclamation": 61711,
"private": 61712,
"pot-outline": 61713,
"plus": 61714,
"plus-bold": 61715,
"play": 61716,
"play-circle": 61717,
"photos": 61718,
"photos-outline": 61719,
"person": 61720,
"pencil": 61721,
"pencil-outline": 61722,
"pause": 61723,
"pause-circle": 61724,
"offline": 61725,
"observers": 61726,
"obscured": 61727,
"notifications-bell": 61728,
"noevidence": 61729,
"microphone": 61730,
"microphone-circle": 61731,
"map": 61732,
"map-marker-outline": 61733,
"map-layers": 61734,
"magnifying-glass": 61735,
"location-crosshairs": 61736,
"list-square": 61737,
"leaf": 61738,
"layers": 61739,
"laptop": 61740,
"label": 61741,
"label-outline": 61742,
"kebab-menu": 61743,
"info-circle-outline": 61744,
"inaturalist": 61745,
"identifiers": 61746,
"id-agree": 61747,
"iconic-unknown": 61748,
"iconic-reptilia": 61749,
"iconic-protozoa": 61750,
"iconic-plantae": 61751,
"iconic-mollusca": 61752,
"iconic-mammalia": 61753,
"iconic-insecta": 61754,
"iconic-mammalia": 61755,
"iconic-mollusca": 61756,
"iconic-plantae": 61757,
"iconic-protozoa": 61758,
"iconic-reptilia": 61759,
"iconic-unknown": 61760,
"id-agree": 61761,
"identifiers": 61762,
"inaturalist": 61763,
"info-circle-outline": 61764,
"kebab-menu": 61765,
"label-outline": 61766,
"label": 61767,
"laptop": 61768,
"layers": 61769,
"leaf": 61770,
"list-square": 61771,
"location-crosshairs": 61772,
"magnifying-glass": 61773,
"map-layers": 61774,
"map-marker-outline": 61775,
"map": 61776,
"microphone-circle": 61777,
"microphone": 61778,
"noevidence": 61779,
"notifications-bell": 61780,
"obscured": 61781,
"observers": 61782,
"offline": 61783,
"pause-circle": 61784,
"pause": 61785,
"pencil-outline": 61786,
"pencil": 61787,
"person": 61788,
"photos-outline": 61789,
"photos": 61790,
"play-circle": 61791,
"play": 61792,
"plus-bold": 61793,
"plus": 61794,
"pot-outline": 61795,
"private": 61796,
"rotate-exclamation": 61797,
"rotate-right": 61798,
"rotate": 61799,
"share": 61800,
"sliders": 61801,
"sound-bold-outline": 61802,
"sound-outline": 61803,
"sounds": 61804,
"sparkly-label": 61805,
"star-bold-outline": 61806,
"star": 61807,
"stop": 61808,
"trash-outline": 61809,
"trash": 61810,
"triangle-exclamation": 61811
"iconic-fungi": 61755,
"iconic-chromista": 61756,
"iconic-aves": 61757,
"iconic-arachnida": 61758,
"iconic-animalia": 61759,
"iconic-amphibia": 61760,
"iconic-actinopterygii": 61761,
"help": 61762,
"help-circle": 61763,
"help-circle-outline": 61764,
"heart": 61765,
"hamburger-menu": 61766,
"grid": 61767,
"grid-square": 61768,
"globe-outline": 61769,
"gear": 61770,
"gallery": 61771,
"flip": 61772,
"flash-on": 61773,
"flash-off": 61774,
"flag": 61775,
"edit-comment": 61776,
"door-exit": 61777,
"currentlocation": 61778,
"crop": 61779,
"creative-commons": 61780,
"copyright": 61781,
"copy": 61782,
"compass-rose-outline": 61783,
"comments": 61784,
"comments-outline": 61785,
"close": 61786,
"close-bold": 61787,
"clock-outline": 61788,
"circle-dots": 61789,
"chevron-right-circle": 61790,
"chevron-left": 61791,
"chevron-left-circle": 61792,
"checkmark-circle": 61793,
"checkmark-circle-outline": 61794,
"check": 61795,
"caret": 61796,
"camera": 61797,
"briefcase": 61798,
"book": 61799,
"binoculars": 61800,
"ban": 61801,
"arrow-up": 61802,
"arrow-up-small": 61803,
"arrow-up-circle-dots": 61804,
"arrow-up-bold-circle": 61805,
"arrow-up-bold-circle-outline": 61806,
"arrow-turn-down-right": 61807,
"arrow-down-bold-circle": 61808,
"arrow-down-bold-circle-outline": 61809,
"arcamera": 61810,
"add-comment-outline": 61811
}

View File

@@ -20,7 +20,6 @@ import type { Node } from "react";
import React, { useState } from "react";
import openMap from "react-native-open-maps";
import { useTheme } from "react-native-paper";
import IconMaterial from "react-native-vector-icons/MaterialCommunityIcons";
import { getShadowForColor } from "styles/global";
type Props = {
@@ -52,18 +51,7 @@ const FloatingActionButton = ( {
"m-5",
buttonClassName
);
if ( icon === "export-variant" ) {
return (
<INatIconButton
style={getShadowForColor( theme.colors.primary )}
className={fabClassNames}
onPress={onPress}
accessibilityLabel={accessibilityLabel}
>
<IconMaterial name={icon} size={24} />
</INatIconButton>
);
}
return (
<INatIconButton
style={getShadowForColor( theme.colors.primary )}

View File

@@ -2,10 +2,9 @@ import i18next from "i18next";
import { Alert, Platform } from "react-native";
import Config from "react-native-config";
import RNFS from "react-native-fs";
import { log } from "sharedHelpers/logger";
import { getPredictionsForImage } from "vision-camera-plugin-inatvision";
import { log } from "../../react-native-logs.config";
const logger = log.extend( "cvModel" );
const modelFiles = {
@@ -21,12 +20,12 @@ const modelFiles = {
};
export const modelPath: string = Platform.select( {
ios: `${RNFS.DocumentDirectoryPath}/${modelFiles.IOSMODEL}`,
ios: `${RNFS.MainBundlePath}/${modelFiles.IOSMODEL}`,
android: `${RNFS.DocumentDirectoryPath}/${modelFiles.ANDROIDMODEL}`
} );
export const taxonomyPath: string = Platform.select( {
ios: `${RNFS.DocumentDirectoryPath}/${modelFiles.IOSTAXONOMY}`,
ios: `${RNFS.MainBundlePath}/${modelFiles.IOSTAXONOMY}`,
android: `${RNFS.DocumentDirectoryPath}/${modelFiles.ANDROIDTAXONOMY}`
} );
@@ -75,50 +74,9 @@ const addCameraFilesAndroid = () => {
} );
};
const addCameraFilesiOS = () => {
const copyFilesiOS = async ( source, destination ) => {
try {
await RNFS.unlink( destination );
} catch ( unlinkError ) {
console.log( "Error deleting file at ", destination, ": ", unlinkError );
}
try {
await RNFS.copyFile( source, destination );
} catch ( copyError ) {
console.error(
`Error moving file from ${source} to ${destination}: `,
copyError
);
}
};
RNFS.readDir( RNFS.MainBundlePath ).then( results => {
// iOS will error out during build if those files are not found,
// because they are linked in the xcode project
const model = modelFiles.IOSMODEL;
const taxonomy = modelFiles.IOSTAXONOMY;
const hasModel = results.find( r => r.name === model );
// Android writes over existing files
if ( hasModel !== undefined ) {
copyFilesiOS( `${RNFS.MainBundlePath}/${model}`, modelPath );
copyFilesiOS( `${RNFS.MainBundlePath}/${taxonomy}`, taxonomyPath );
} else {
logger.debug( "No model asset found to copy into document directory." );
Alert.alert(
i18next.t( "No-model-found" ),
i18next.t( "During-app-start-no-model-found" )
);
}
} );
};
export const addARCameraFiles = async () => {
export const addARCameraFiles = ( ) => {
// RNFS overwrites whatever files existed before
if ( Platform.OS === "android" ) {
addCameraFilesAndroid();
} else if ( Platform.OS === "ios" ) {
addCameraFilesiOS();
addCameraFilesAndroid( );
}
};

View File

@@ -149,7 +149,7 @@ exports[`CustomTabBar with advanced user layout should render correctly 1`] = `
]
}
>
</Text>
</View>
</View>
@@ -240,7 +240,7 @@ exports[`CustomTabBar with advanced user layout should render correctly 1`] = `
]
}
>
</Text>
</View>
</View>
@@ -375,7 +375,7 @@ exports[`CustomTabBar with advanced user layout should render correctly 1`] = `
]
}
>
</Text>
</View>
</BVLinearGradient>
@@ -467,7 +467,7 @@ exports[`CustomTabBar with advanced user layout should render correctly 1`] = `
]
}
>
</Text>
</View>
</View>
@@ -558,7 +558,7 @@ exports[`CustomTabBar with advanced user layout should render correctly 1`] = `
]
}
>
</Text>
</View>
</View>

View File

@@ -36,7 +36,7 @@ exports[`ActivityCount renders reliably 1`] = `
]
}
>
</Text>
<Text
style={

View File

@@ -36,7 +36,7 @@ exports[`CommentsCount renders default reliably 1`] = `
]
}
>
</Text>
<Text
style={
@@ -100,7 +100,7 @@ exports[`CommentsCount renders filled reliably 1`] = `
]
}
>
</Text>
<Text
style={
@@ -164,7 +164,7 @@ exports[`CommentsCount renders white reliably 1`] = `
]
}
>
</Text>
<Text
style={

View File

@@ -36,7 +36,7 @@ exports[`IdentificationsCount renders default reliably 1`] = `
]
}
>
</Text>
<Text
style={
@@ -100,7 +100,7 @@ exports[`IdentificationsCount renders filled reliably 1`] = `
]
}
>
</Text>
<Text
style={
@@ -164,7 +164,7 @@ exports[`IdentificationsCount renders white reliably 1`] = `
]
}
>
</Text>
<Text
style={

View File

@@ -86,7 +86,7 @@ exports[`INatIconButton renders correctly 1`] = `
]
}
>
</Text>
</View>
</View>

View File

@@ -169,7 +169,7 @@ exports[`InlineUser when offline renders reliably 1`] = `
}
testID="InlineUser.FallbackPicture"
>
</Text>
</View>
<Text
@@ -275,7 +275,7 @@ exports[`InlineUser when user has no icon set renders reliably 1`] = `
}
testID="InlineUser.FallbackPicture"
>
</Text>
</View>
<Text

View File

@@ -135,7 +135,7 @@ exports[`ObsGridItem for an observation with a photo should render 1`] = `
]
}
>
</Text>
</View>
</View>
@@ -326,7 +326,7 @@ exports[`ObsGridItem for an observation with a photo should render 1`] = `
]
}
>
</Text>
</View>
</View>
@@ -495,7 +495,7 @@ exports[`ObsGridItem for an observation without a photo should render 1`] = `
]
}
>
</Text>
</View>
</View>
@@ -686,7 +686,7 @@ exports[`ObsGridItem for an observation without a photo should render 1`] = `
]
}
>
</Text>
</View>
</View>

View File

@@ -67,7 +67,7 @@ exports[`UploadStatus displays progress bar when progress is greater than 5% cor
]
}
>
</Text>
</View>
<CircularProgress
@@ -152,7 +152,7 @@ exports[`UploadStatus displays progress bar when progress is less than 5% correc
]
}
>
</Text>
</View>
<View
@@ -199,7 +199,7 @@ exports[`UploadStatus displays progress bar when progress is less than 5% correc
]
}
>
</Text>
</View>
</View>

View File

@@ -131,7 +131,7 @@ exports[`Checkbox renders reliably 1`] = `
]
}
>
</Text>
</View>
</View>
@@ -295,7 +295,7 @@ exports[`Checkbox renders reliably being checked 1`] = `
]
}
>
</Text>
</View>
</View>

View File

@@ -276,7 +276,7 @@ exports[`TaxonResult should render correctly 1`] = `
]
}
>
</Text>
</View>
</View>
@@ -489,7 +489,7 @@ exports[`TaxonResult should render correctly 1`] = `
]
}
>
</Text>
</View>
</View>
@@ -583,7 +583,7 @@ exports[`TaxonResult should render correctly 1`] = `
]
}
>
</Text>
</View>
</View>

View File

@@ -20,6 +20,6 @@ exports[`INatIcon renders correctly 1`] = `
]
}
>
</Text>
`;