Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.15.6 #660

Merged
merged 29 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
4d84144
Remove unused prop
jtklein Dec 27, 2023
111ae2b
Add a check that only runs a function once per species
jtklein Dec 27, 2023
b0b1271
Bump version and build
jtklein Dec 27, 2023
4ff6cf2
Small UI fix, missing spacing on Settings page
jtklein Jan 12, 2024
939c332
Update package-lock.json
jtklein Jan 12, 2024
1cf3933
Added logging around observation upload
jtklein Jan 12, 2024
4a01eeb
Bump build
jtklein Jan 12, 2024
972f545
Fix wrong import
jtklein Jan 12, 2024
6d8e8e4
Update to react native 71.15
jtklein Jan 12, 2024
98297cc
Bump build
jtklein Jan 12, 2024
dc42db2
Split up logging of object
jtklein Jan 12, 2024
7db8872
Bump build
jtklein Jan 12, 2024
d0c4ddc
Update project.pbxproj
jtklein Jan 12, 2024
ac17aed
Update inaturalistjs
jtklein Jan 14, 2024
d94b428
Change user agent param
jtklein Jan 15, 2024
c48a279
Remove unused user agent string
jtklein Jan 15, 2024
a90a470
Reset ref after use
jtklein Jan 15, 2024
4bf1ff3
Add small explanation text to warning modal
jtklein Nov 29, 2023
0760260
Update patch version of vision-camera
jtklein Nov 29, 2023
a51ff47
Truncate the positional accuracy which is supposed to be int in realm
jtklein Jan 16, 2024
b8d5fef
Bump build
jtklein Jan 16, 2024
ef93967
Update Gemfile.lock
jtklein Jan 16, 2024
94a0f6c
Bump some dependencies
jtklein Jan 16, 2024
10d9bc3
Update navigation dependencies
jtklein Jan 16, 2024
22d31d7
Bump realm
jtklein Jan 16, 2024
f3d85ab
Update some testing and dev dependencies
jtklein Jan 16, 2024
0e053f3
Bump build
jtklein Jan 16, 2024
17e96ee
Update Gemfile.lock
jtklein Jan 16, 2024
b76ff42
Update copyright year
jtklein Jan 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ source "https://rubygems.org"
ruby '>= 2.6.10'

gem 'cocoapods', '>= 1.11.3'
gem 'activesupport', '>= 6.1.7.3', '< 7.1.0'
gem "fastlane"

plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
Expand Down
44 changes: 17 additions & 27 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,10 @@ GEM
specs:
CFPropertyList (3.0.6)
rexml
activesupport (7.1.2)
base64
bigdecimal
activesupport (7.0.8)
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
Expand All @@ -21,24 +16,22 @@ GEM
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.869.0)
aws-sdk-core (3.190.0)
aws-partitions (1.881.0)
aws-sdk-core (3.190.3)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.75.0)
aws-sdk-kms (1.76.0)
aws-sdk-core (~> 3, >= 3.188.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.141.0)
aws-sdk-s3 (1.142.0)
aws-sdk-core (~> 3, >= 3.189.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.8)
aws-sigv4 (1.8.0)
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
base64 (0.2.0)
bigdecimal (3.1.5)
claide (1.1.0)
cocoapods (1.14.3)
addressable (~> 2.8)
Expand Down Expand Up @@ -82,19 +75,16 @@ GEM
commander (4.6.0)
highline (~> 2.0.0)
concurrent-ruby (1.2.2)
connection_pool (2.4.1)
declarative (0.0.20)
digest-crc (0.6.5)
rake (>= 12.0.0, < 14.0.0)
domain_name (0.6.20231109)
domain_name (0.6.20240107)
dotenv (2.8.1)
drb (2.2.0)
ruby2_keywords
emoji_regex (3.2.3)
escape (0.0.4)
ethon (0.16.0)
ffi (>= 1.15.0)
excon (0.108.0)
excon (0.109.0)
faraday (1.10.3)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
Expand Down Expand Up @@ -123,8 +113,8 @@ GEM
faraday-retry (1.0.3)
faraday_middleware (1.2.0)
faraday (~> 1.0)
fastimage (2.2.7)
fastlane (2.217.0)
fastimage (2.3.0)
fastlane (2.218.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
Expand All @@ -151,7 +141,7 @@ GEM
mini_magick (>= 4.9.4, < 5.0.0)
multipart-post (>= 2.0.0, < 3.0.0)
naturally (~> 2.2)
optparse (~> 0.1.1)
optparse (>= 0.1.1)
plist (>= 3.1.0, < 4.0.0)
rubyzip (>= 2.0.0, < 3.0.0)
security (= 0.1.3)
Expand Down Expand Up @@ -184,19 +174,19 @@ GEM
google-apis-core (>= 0.11.0, < 2.a)
google-apis-playcustomapp_v1 (0.13.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-storage_v1 (0.29.0)
google-apis-storage_v1 (0.31.0)
google-apis-core (>= 0.11.0, < 2.a)
google-cloud-core (1.6.1)
google-cloud-env (>= 1.0, < 3.a)
google-cloud-errors (~> 1.0)
google-cloud-env (2.1.0)
faraday (>= 1.0, < 3.a)
google-cloud-errors (1.3.1)
google-cloud-storage (1.45.0)
google-cloud-storage (1.47.0)
addressable (~> 2.8)
digest-crc (~> 0.4)
google-apis-iamcredentials_v1 (~> 0.1)
google-apis-storage_v1 (~> 0.29.0)
google-apis-storage_v1 (~> 0.31.0)
google-cloud-core (~> 1.6)
googleauth (>= 0.16.2, < 2.a)
mini_mime (~> 1.0)
Expand All @@ -218,18 +208,17 @@ GEM
jwt (2.7.1)
mini_magick (4.12.0)
mini_mime (1.1.5)
minitest (5.20.0)
minitest (5.21.1)
molinillo (0.8.0)
multi_json (1.15.0)
multipart-post (2.3.0)
mutex_m (0.2.0)
nanaimo (0.3.0)
nap (1.1.0)
naturally (2.2.1)
netrc (0.11.0)
optparse (0.1.1)
optparse (0.4.0)
os (1.1.4)
plist (3.7.0)
plist (3.7.1)
public_suffix (4.0.7)
rake (13.1.0)
representable (3.2.0)
Expand Down Expand Up @@ -283,6 +272,7 @@ PLATFORMS
ruby

DEPENDENCIES
activesupport (>= 6.1.7.3, < 7.1.0)
cocoapods (>= 1.11.3)
fastlane
fastlane-plugin-versioning_android
Expand Down
2 changes: 1 addition & 1 deletion MIT-LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2023 iNaturalist
Copyright (c) 2024 iNaturalist

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ android {
applicationId "org.inaturalist.seek"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 326
versionName "2.15.5"
versionCode 332
versionName "2.15.6"
// for creating ic_seek_adaptiveappicon.xml
vectorDrawables.useSupportLibrary = true
}
Expand Down
4 changes: 2 additions & 2 deletions components/Auth/PrivacyPolicyScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ const PrivacyPolicyScreen = (): React.Node => {
</p>

<p>
© Copyright 2023 iNaturalist. All Rights Reserved.
© Copyright 2024 iNaturalist. All Rights Reserved.
</p>`;

const seekHtml = `<p><i>Last Revised on July 11, 2023</i></p>
Expand Down Expand Up @@ -484,7 +484,7 @@ const PrivacyPolicyScreen = (): React.Node => {
San Rafael, CA 94915-0357<br>
</p>

<p>© Copyright 2023 iNaturalist. All Rights Reserved.</p>
<p>© Copyright 2024 iNaturalist. All Rights Reserved.</p>

<p><i>Revised on July 11, 2023.</i></p>`;

Expand Down
2 changes: 1 addition & 1 deletion components/Auth/TermsOfServiceScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ const TermsOfServiceScreen = ( ): React.Node => {
</ol>

<p>
© Copyright 2023 iNaturalist. All rights reserved.
© Copyright 2024 iNaturalist. All rights reserved.
</p>`;

const DEFAULT_PROPS = {
Expand Down
4 changes: 3 additions & 1 deletion components/Home/Announcements/Announcements.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ const Announcements = ( ): React.Node => {
};
const accessToken = await fetchAccessToken();
const apiToken = await fetchJSONWebToken( accessToken );
const options = { api_token: apiToken, user_agent: createUserAgent() };
const headers = {};
headers["user-agent"] = createUserAgent();
const options = { api_token: apiToken, headers };
inatjs.announcements
.search( params, options )
.then( ( { total_results, results } ) => {
Expand Down
12 changes: 11 additions & 1 deletion components/Modals/WarningModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ const WarningModal = ( { closeModal }: Props ): React.Node => (
</StyledText>
</View>
<View style={viewStyles.marginTop} />
<StyledText
allowFontScaling={false}
style={[textStyles.text, textStyles.wideText]}
>
{i18n.t( "warning.tip_0" )}
</StyledText>
<View style={viewStyles.marginSmall} />
<View>
{[1, 2, 3].map( ( warning ) => {
const iconName = icons[`warning_${warning}`];
Expand All @@ -47,7 +54,10 @@ const WarningModal = ( { closeModal }: Props ): React.Node => (
);
} )}
<View style={viewStyles.marginSmall} />
<StyledText allowFontScaling={false} style={[textStyles.text, textStyles.wideText]}>
<StyledText
allowFontScaling={false}
style={[textStyles.text, textStyles.wideText]}
>
{i18n.t( "warning.tip_4" )}
</StyledText>
</View>
Expand Down
4 changes: 2 additions & 2 deletions components/PostToiNat/PostScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const PostScreen = ( ): Node => {
longitude: preciseLong,
observed_on_string: initialDate,
place_guess: null,
positional_accuracy: accuracy,
positional_accuracy: Math.trunc( accuracy ),
taxon_id: taxaId,
// this shows that the id is recommended by computer vision
vision: true
Expand All @@ -91,7 +91,7 @@ const PostScreen = ( ): Node => {
...editedObservation,
latitude: coords.latitude,
longitude: coords.longitude,
positional_accuracy: coords.accuracy
positional_accuracy: Math.trunc( coords.accuracy )
} } );
}, [editedObservation] );

Expand Down
4 changes: 3 additions & 1 deletion components/PostToiNat/hooks/postingHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ const useSearchSpecies = ( speciesName: ?string ): any => {
locale: i18n.locale
};

const options = { user_agent: createUserAgent( ) };
const headers = {};
headers["user-agent"] = createUserAgent();
const options = { headers };

inatjs.taxa.autocomplete( params, options ).then( ( { results } ) => {
if ( results.length === 0 ) { return; }
Expand Down
21 changes: 18 additions & 3 deletions components/Providers/ObservationProvider.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow

import React, { useState, useEffect, useCallback } from "react";
import React, { useState, useEffect, useCallback, useRef } from "react";
import type { Node } from "react";
import { Platform } from "react-native";
import inatjs from "inaturalistjs";
Expand Down Expand Up @@ -57,7 +57,9 @@ const ObservationProvider = ( { children }: Props ): Node => {
};

const fetchPhoto = useCallback( async ( id ) => {
const options = { user_agent: createUserAgent( ) };
const headers = {};
headers["user-agent"] = createUserAgent();
const options = { headers };

// probably should break this into a helper function to use in other places
// like species nearby fetches for better offline experience
Expand Down Expand Up @@ -86,6 +88,7 @@ const ObservationProvider = ( { children }: Props ): Node => {
}
}, [] );

const currentSpeciesID = useRef( null );
const handleSpecies = useCallback( async ( param ) => {
if ( !observation ) { return; }
const { predictions, errorCode, latitude } = observation.image;
Expand Down Expand Up @@ -115,6 +118,16 @@ const ObservationProvider = ( { children }: Props ): Node => {
};
};

// Only run this once for a given species because fetchSpeciesSeenDate throws an error in
// a C++ library of realm if the function is called twice. Even though this error only happens
// for the first time a user observes a species that counts towards a challenge, having this check
// here does not have any negative effects on the app I think.
if ( currentSpeciesID.current === species.taxon_id ) {
currentSpeciesID.current = null;
return;
} else {
currentSpeciesID.current = species.taxon_id;
}
const seenDate = await fetchSpeciesSeenDate( Number( species.taxon_id ) );
const mediumPhoto = await fetchPhoto( species.taxon_id );

Expand Down Expand Up @@ -272,7 +285,9 @@ const ObservationProvider = ( { children }: Props ): Node => {
const fetchOnlineVisionResults = async ( ) => {
const uploadParams = await flattenUploadParameters( image );
const token = createJwtToken( );
const options = { api_token: token, user_agent: createUserAgent() };
const headers = {};
headers["user-agent"] = createUserAgent();
const options = { api_token: token, headers };

try {
const r = await inatjs.computervision.score_image( uploadParams, options );
Expand Down
5 changes: 2 additions & 3 deletions components/SeekYearInReview/SeekYearInReviewMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ import GreenButton from "../UIComponents/Buttons/GreenButton";
import { getBounds, getCenterOfBounds } from "geolib";

type Props = {
+region: Object,
+id: number,
+seenDate: ?string,
+year: number,
+observations: Array<Object>,
};

const SeekYearInReviewMap = ( { year, observations }: Props ): React.Node => {
Expand Down
1 change: 1 addition & 0 deletions components/Settings/CameraSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const CameraSettings = ( ): Node => {
return (
<>
<StyledText style={textStyles.header}>{i18n.t( "settings.header" ).toLocaleUpperCase()}</StyledText>
<View style={viewStyles.marginSmall} />
<StyledText style={viewStyles.radioButtonSmallMargin}>
{radioButtons.map( ( obj, i ) => <RadioButton
key={`${obj.label}${i}`}
Expand Down
4 changes: 3 additions & 1 deletion components/Species/OnlineOnlyCards/INatObs.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ const INatObs = ( { id, timesSeen, region }: Props ): Node => {
taxon_id: id
};

const options = { user_agent: createUserAgent() };
const headers = {};
headers["user-agent"] = createUserAgent();
const options = { headers };

inatjs.observations.speciesCounts( params, options ).then( ( { results } ) => {
if ( isFocused ) {
Expand Down
4 changes: 3 additions & 1 deletion components/Species/OnlineOnlyCards/SimilarSpecies.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ const SimilarSpecies = ( { id }: Props ): Node => {
locale: i18n.locale
};

const options = { user_agent: createUserAgent( ) };
const headers = {};
headers["user-agent"] = createUserAgent();
const options = { headers };

inatjs.identifications.similar_species( params, options ).then( ( { results } ) => {
const species = results.map( r => r.taxon );
Expand Down
4 changes: 3 additions & 1 deletion components/Species/OnlineOnlyCards/SpeciesStats.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ const SpeciesStats = ( { loading, stats, region, id, seenDate }: Props ): Node =
taxon_id: id
};

const options = { user_agent: createUserAgent() };
const headers = {};
headers["user-agent"] = createUserAgent();
const options = { headers };

inatjs.observations.search( params, options ).then( ( { results } ) => {
if ( results.length > 0 ) {
Expand Down
6 changes: 3 additions & 3 deletions components/Species/hooks/speciesDetailHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import Realm from "realm";
import inatjs from "inaturalistjs";

import i18n from "../../../i18n";
import createUserAgent from "../../../utility/userAgent";
import realmConfig from "../../../models";

const useSpeciesSeen = ( id: number ): any => {
Expand Down Expand Up @@ -52,10 +51,11 @@ const useTaxonDetails = ( id: number ): any => {
useEffect( ( ) => {
const fetchTaxonDetails = async ( ) => {
const localeParams = { locale: i18n.locale };
const options = { user_agent: createUserAgent( ) };

try {
const response = await inatjs.taxa.fetch( id, localeParams, options );
// TODO: we used to add the user agent string to options, but it actually does not get
// destructured in naturalistjs, so we would need to add it's usage like in get or post
const response = await inatjs.taxa.fetch( id, localeParams );
const taxa = response.results[0];
const scientificName = taxa.name;
const conservationStatus = taxa.taxon_photos[0].taxon.conservation_status;
Expand Down
4 changes: 3 additions & 1 deletion components/iNaturalist/hooks/inatHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ const useFetchPhotos = ( ): any => {
locale: i18n.locale
};

const options = { user_agent: createUserAgent( ) };
const headers = {};
headers["user-agent"] = createUserAgent();
const options = { headers };

inatjs.observations.search( params, options ).then( ( { results } ) => {
const taxa = results.map( ( r ) => r.taxon );
Expand Down
Loading
Loading