Merge pull request #188 from tooot-app/main

Preparing for v3
This commit is contained in:
xmflsct 2021-12-18 21:08:39 +01:00 committed by GitHub
commit fbddcd2940
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 13554 additions and 1748 deletions

View File

@ -188,6 +188,10 @@ android {
} }
dependencies { dependencies {
implementation ("androidx.lifecycle:lifecycle-runtime-ktx:2.3.0") {
force = true
}
implementation fileTree(dir: "libs", include: ["*.jar"]) implementation fileTree(dir: "libs", include: ["*.jar"])
//noinspection GradleDynamicVersion //noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules implementation "com.facebook.react:react-native:+" // From node_modules

View File

@ -2,11 +2,12 @@
buildscript { buildscript {
ext { ext {
buildToolsVersion = "29.0.3" buildToolsVersion = "30.0.2"
minSdkVersion = 21 minSdkVersion = 21
compileSdkVersion = 30 compileSdkVersion = 30
targetSdkVersion = 30 targetSdkVersion = 30
ndkVersion = "20.1.5948944" ndkVersion = "21.4.7075529"
kotlinVersion = '1.5.32'
} }
repositories { repositories {
google() google()
@ -15,7 +16,7 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.google.gms:google-services:4.3.3' classpath 'com.google.gms:google-services:4.3.3'
classpath("com.android.tools.build:gradle:4.1.0") classpath("com.android.tools.build:gradle:4.2.0")
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@ -5,75 +5,76 @@ PODS:
- ExpoModulesCore - ExpoModulesCore
- EXAV (10.1.3): - EXAV (10.1.3):
- ExpoModulesCore - ExpoModulesCore
- EXConstants (12.1.3): - EXConstants (13.0.0):
- ExpoModulesCore - ExpoModulesCore
- EXCrypto (10.0.3): - EXCrypto (10.1.1):
- ExpoModulesCore - ExpoModulesCore
- EXDevice (4.0.3): - EXDevice (4.1.0):
- ExpoModulesCore - ExpoModulesCore
- EXErrorRecovery (3.0.3): - EXErrorRecovery (3.0.4):
- ExpoModulesCore - ExpoModulesCore
- EXFileSystem (13.0.3): - EXFileSystem (13.1.0):
- ExpoModulesCore - ExpoModulesCore
- EXFirebaseAnalytics (5.0.3): - EXFirebaseAnalytics (6.0.0):
- EXFirebaseCore - EXFirebaseCore
- ExpoModulesCore - ExpoModulesCore
- Firebase/Core (= 7.7.0) - Firebase/Core (= 7.7.0)
- EXFirebaseCore (4.0.3): - EXFirebaseCore (4.1.0):
- ExpoModulesCore - ExpoModulesCore
- Firebase/Core (= 7.7.0) - Firebase/Core (= 7.7.0)
- EXFont (10.0.3): - EXFont (10.0.4):
- ExpoModulesCore - ExpoModulesCore
- EXHaptics (11.0.3): - EXImageLoader (3.1.0):
- ExpoModulesCore
- EXImageLoader (3.0.0):
- ExpoModulesCore - ExpoModulesCore
- React-Core - React-Core
- EXImageManipulator (10.1.2): - EXImageManipulator (10.2.0):
- EXImageLoader - EXImageLoader
- ExpoModulesCore - ExpoModulesCore
- EXImagePicker (11.0.3): - EXImagePicker (12.0.1):
- ExpoModulesCore - ExpoModulesCore
- EXJSONUtils (0.2.0) - EXJSONUtils (0.2.0)
- EXKeepAwake (10.0.0): - EXKeepAwake (10.0.1):
- ExpoModulesCore
- EXLocalization (11.0.0):
- ExpoModulesCore - ExpoModulesCore
- EXManifests (0.2.2): - EXManifests (0.2.2):
- EXJSONUtils - EXJSONUtils
- EXMediaLibrary (13.0.3): - EXMediaLibrary (14.0.0):
- ExpoModulesCore - ExpoModulesCore
- React-Core - React-Core
- EXNotifications (0.13.3): - EXNotifications (0.14.0):
- ExpoModulesCore - ExpoModulesCore
- EXPermissions (13.0.3): - EXPermissions (13.1.0):
- ExpoModulesCore - ExpoModulesCore
- Expo (43.0.4): - Expo (44.0.0):
- ExpoModulesCore - ExpoModulesCore
- ExpoModulesCore (0.4.4): - ExpoHaptics (11.1.0):
- ExpoModulesCore
- ExpoLocalization (12.0.0):
- ExpoModulesCore
- ExpoModulesCore (0.6.3):
- React-Core - React-Core
- EXRandom (12.0.1): - ReactCommon/turbomodule/core
- EXRandom (12.1.1):
- React-Core - React-Core
- EXScreenCapture (4.0.3): - EXScreenCapture (4.1.0):
- ExpoModulesCore - ExpoModulesCore
- EXSecureStore (11.0.3): - EXSecureStore (11.1.0):
- ExpoModulesCore - ExpoModulesCore
- EXSplashScreen (0.13.5): - EXSplashScreen (0.14.0):
- ExpoModulesCore - ExpoModulesCore
- React-Core - React-Core
- EXStoreReview (5.0.3): - EXStoreReview (5.1.0):
- ExpoModulesCore - ExpoModulesCore
- EXStructuredHeaders (2.0.0) - EXStructuredHeaders (2.1.0)
- EXUpdates (0.10.15): - EXUpdates (0.11.1):
- EXManifests - EXManifests
- ExpoModulesCore - ExpoModulesCore
- EXStructuredHeaders - EXStructuredHeaders
- EXUpdatesInterface - EXUpdatesInterface
- React-Core - React-Core
- EXUpdatesInterface (0.4.0) - EXUpdatesInterface (0.5.0)
- EXVideoThumbnails (6.0.3): - EXVideoThumbnails (6.1.0):
- ExpoModulesCore - ExpoModulesCore
- EXWebBrowser (10.0.3): - EXWebBrowser (10.1.0):
- ExpoModulesCore - ExpoModulesCore
- FBLazyVector (0.66.4) - FBLazyVector (0.66.4)
- FBReactNativeSpec (0.66.4): - FBReactNativeSpec (0.66.4):
@ -461,7 +462,7 @@ PODS:
- SDWebImageWebPCoder (~> 0.8.4) - SDWebImageWebPCoder (~> 0.8.4)
- RNGestureHandler (2.1.0): - RNGestureHandler (2.1.0):
- React-Core - React-Core
- RNReanimated (2.3.0): - RNReanimated (2.3.1):
- DoubleConversion - DoubleConversion
- FBLazyVector - FBLazyVector
- FBReactNativeSpec - FBReactNativeSpec
@ -506,7 +507,7 @@ PODS:
- Sentry (7.5.1): - Sentry (7.5.1):
- Sentry/Core (= 7.5.1) - Sentry/Core (= 7.5.1)
- Sentry/Core (7.5.1) - Sentry/Core (7.5.1)
- UMTaskManagerInterface (7.0.3): - UMTaskManagerInterface (7.1.0):
- ExpoModulesCore - ExpoModulesCore
- Yoga (1.14.0) - Yoga (1.14.0)
@ -523,18 +524,18 @@ DEPENDENCIES:
- EXFirebaseAnalytics (from `../node_modules/expo-firebase-analytics/ios`) - EXFirebaseAnalytics (from `../node_modules/expo-firebase-analytics/ios`)
- EXFirebaseCore (from `../node_modules/expo-firebase-core/ios`) - EXFirebaseCore (from `../node_modules/expo-firebase-core/ios`)
- EXFont (from `../node_modules/expo-font/ios`) - EXFont (from `../node_modules/expo-font/ios`)
- EXHaptics (from `../node_modules/expo-haptics/ios`)
- EXImageLoader (from `../node_modules/expo-image-loader/ios`) - EXImageLoader (from `../node_modules/expo-image-loader/ios`)
- EXImageManipulator (from `../node_modules/expo-image-manipulator/ios`) - EXImageManipulator (from `../node_modules/expo-image-manipulator/ios`)
- EXImagePicker (from `../node_modules/expo-image-picker/ios`) - EXImagePicker (from `../node_modules/expo-image-picker/ios`)
- EXJSONUtils (from `../node_modules/expo-json-utils/ios`) - EXJSONUtils (from `../node_modules/expo-json-utils/ios`)
- EXKeepAwake (from `../node_modules/expo-keep-awake/ios`) - EXKeepAwake (from `../node_modules/expo-keep-awake/ios`)
- EXLocalization (from `../node_modules/expo-localization/ios`)
- EXManifests (from `../node_modules/expo-manifests/ios`) - EXManifests (from `../node_modules/expo-manifests/ios`)
- EXMediaLibrary (from `../node_modules/expo-media-library/ios`) - EXMediaLibrary (from `../node_modules/expo-media-library/ios`)
- EXNotifications (from `../node_modules/expo-notifications/ios`) - EXNotifications (from `../node_modules/expo-notifications/ios`)
- EXPermissions (from `../node_modules/expo-permissions/ios`) - EXPermissions (from `../node_modules/expo-permissions/ios`)
- Expo (from `../node_modules/expo/ios`) - Expo (from `../node_modules/expo/ios`)
- ExpoHaptics (from `../node_modules/expo-haptics/ios`)
- ExpoLocalization (from `../node_modules/expo-localization/ios`)
- ExpoModulesCore (from `../node_modules/expo-modules-core/ios`) - ExpoModulesCore (from `../node_modules/expo-modules-core/ios`)
- EXRandom (from `../node_modules/expo-random/ios`) - EXRandom (from `../node_modules/expo-random/ios`)
- EXScreenCapture (from `../node_modules/expo-screen-capture/ios`) - EXScreenCapture (from `../node_modules/expo-screen-capture/ios`)
@ -640,8 +641,6 @@ EXTERNAL SOURCES:
:path: "../node_modules/expo-firebase-core/ios" :path: "../node_modules/expo-firebase-core/ios"
EXFont: EXFont:
:path: "../node_modules/expo-font/ios" :path: "../node_modules/expo-font/ios"
EXHaptics:
:path: "../node_modules/expo-haptics/ios"
EXImageLoader: EXImageLoader:
:path: "../node_modules/expo-image-loader/ios" :path: "../node_modules/expo-image-loader/ios"
EXImageManipulator: EXImageManipulator:
@ -652,8 +651,6 @@ EXTERNAL SOURCES:
:path: "../node_modules/expo-json-utils/ios" :path: "../node_modules/expo-json-utils/ios"
EXKeepAwake: EXKeepAwake:
:path: "../node_modules/expo-keep-awake/ios" :path: "../node_modules/expo-keep-awake/ios"
EXLocalization:
:path: "../node_modules/expo-localization/ios"
EXManifests: EXManifests:
:path: "../node_modules/expo-manifests/ios" :path: "../node_modules/expo-manifests/ios"
EXMediaLibrary: EXMediaLibrary:
@ -664,6 +661,10 @@ EXTERNAL SOURCES:
:path: "../node_modules/expo-permissions/ios" :path: "../node_modules/expo-permissions/ios"
Expo: Expo:
:path: "../node_modules/expo/ios" :path: "../node_modules/expo/ios"
ExpoHaptics:
:path: "../node_modules/expo-haptics/ios"
ExpoLocalization:
:path: "../node_modules/expo-localization/ios"
ExpoModulesCore: ExpoModulesCore:
:path: "../node_modules/expo-modules-core/ios" :path: "../node_modules/expo-modules-core/ios"
EXRandom: EXRandom:
@ -780,37 +781,37 @@ SPEC CHECKSUMS:
DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662 DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662
EXApplication: 0e15240e4d125b62f1cae48759ffbbd32b9286a6 EXApplication: 0e15240e4d125b62f1cae48759ffbbd32b9286a6
EXAV: 8adf9a1c0161144d77e96149a1e5a5f9358be290 EXAV: 8adf9a1c0161144d77e96149a1e5a5f9358be290
EXConstants: 6d585d93723b18d7a8c283591a335609e3bc153e EXConstants: 5d18484e38e8eacef7695a82214b6ac90133dedf
EXCrypto: 7bcda085ffaccdaf3a252c20774a08be4277b8e3 EXCrypto: e3c0853c2a9ef885928f6227b967b9598132f727
EXDevice: d19bbef7ab8ee4669ef1d6424c538f8d8fe7d6e9 EXDevice: 7de98d8f97088fad9c01e9a68abad07e501208b2
EXErrorRecovery: ac2622400a32be84604591f70d0efff416e4b9a2 EXErrorRecovery: deea88a01d38f8b1c1181b4e1d179b0ba0e4bb5b
EXFileSystem: 99aac7962c11c680681819dd9cbca24e20e5b1e7 EXFileSystem: 7d1309ba6b38b82ef7fc9e80174de3f9184ac8b4
EXFirebaseAnalytics: fd0c025fcf12e45904c2be40beab3f7147746a5b EXFirebaseAnalytics: 27dbc5cb83c244d8404b2927676299f3e172470e
EXFirebaseCore: 2d0e5aac214f977dfbb72379509e6a11481b1400 EXFirebaseCore: 16f39b0ea94ce985a8f2e16cc796bf79bdcfa297
EXFont: 2e1c6fe726d008a039db80df95f48b4921b7fe59 EXFont: 1fb13af43dc517c01c0ff21a6e32f9f9bf2ea602
EXHaptics: f52df335f17192e440d9639c971ebcbb3fb91dec EXImageLoader: df83442d32bcfb57b7cfc5690096b6caf8203f8d
EXImageLoader: 939451be6f7b731aaa6588920b90743f20121a4d EXImageManipulator: 810c7ea8d4cdcc52d07ad377a9b4ffeaee3d937f
EXImageManipulator: 49bbcede2429523edfd95dc242cf7f8fdf271307 EXImagePicker: 91337b8d57a0a8f56800b9ac0f2b2f10aecf88ce
EXImagePicker: bf704ef8e9171b05696a24114b44c6629565b45d
EXJSONUtils: f515cf71710855d7ba5bfc6752af3b9a6f6aad01 EXJSONUtils: f515cf71710855d7ba5bfc6752af3b9a6f6aad01
EXKeepAwake: 8aa32396a5972d26e75e538603aad0f032396503 EXKeepAwake: b571c2ad8323b2fced6e907766e2549f75119471
EXLocalization: bb38414618b30a177482c9a6f5594ec6eb0898c1
EXManifests: 50e42e01335df4e54109dee7be5a91bfd37347db EXManifests: 50e42e01335df4e54109dee7be5a91bfd37347db
EXMediaLibrary: 2a684cca228d6605a72f9995d3e7b8af2a05246c EXMediaLibrary: 6acf919299bccc64a59e6e89a3b792276e309302
EXNotifications: 4a2beb5a2a7292ba64165413811b7c495bcb1297 EXNotifications: d5b454a2363c8743aa9b2888cc0df70a1d9ee816
EXPermissions: 7696f4c16e89981f84c04d96327f7e1e592373c0 EXPermissions: f4c65fa770489cbf16ea17c3013a670671525014
Expo: 363a3f3c60d5a1d4f8badb29a869005487f2d9e4 Expo: 6ca1d5ca8c8264a7131a608afcd01561f79f1e6e
ExpoModulesCore: 47b403a33ad73770c49d7559615b3ea121a36116 ExpoHaptics: c62a5fc7bba0184d0165d559fc2b0fc46168ef40
EXRandom: 64c954ae24619b8d0c18ff46aa96401e98efc977 ExpoLocalization: 83582a967db52987a8479490b056d5eb9fd70552
EXScreenCapture: aa7292f963ccfde7aed4ba6bb6e822e95ef5153e ExpoModulesCore: d04e519b3e8e21523b195bb21a40144e30f1e163
EXSecureStore: 919bf7c28472862020d2cd7b59b69aae160b5d40 EXRandom: 06978dcf45075f3c9e17ae5e726b887316ee9877
EXSplashScreen: 57f329dbf25c5c12800feed79068a056453dc772 EXScreenCapture: 0146fdf6ca4c3402a1cf62b2ddb739a840e08c94
EXStoreReview: ba32e9ebdab47176fe263db022982e4b8a580c28 EXSecureStore: fa0fdde1c81ceee2a3cb0519e649feae42767969
EXStructuredHeaders: 873e7f329c2f6279c1b1e0229df59c9861560b53 EXSplashScreen: 845290df0d2730fdedc59ee6ce3b959d8079a350
EXUpdates: 061b67c33f0e7f8fd335bbb48697c4a4fc8a5157 EXStoreReview: 6143555fc912a4a194300992cd297c3e5b521a8a
EXUpdatesInterface: e1c01b4f5ec76bd1d6cc714938f9edf5ef6379b9 EXStructuredHeaders: 2ce79a3770bd3795bade1aab215ada70deae8bbc
EXVideoThumbnails: 3bdcce697449df005fcc348153e2f854ed462984 EXUpdates: a0ef6520618deee31b45d9a09406682c9e724789
EXWebBrowser: ecb70d9e6edb279d9b10b2bbc9ad4320fcdc4060 EXUpdatesInterface: f459b515151bd73fff7a35366eace34a6c6a0d3f
EXVideoThumbnails: 6c08e978ed7a5542c5dca04a1757363fd29cb2a1
EXWebBrowser: 37388663fa51cbfc883de2244931a5182d948e5f
FBLazyVector: e5569e42a1c79ca00521846c223173a57aca1fe1 FBLazyVector: e5569e42a1c79ca00521846c223173a57aca1fe1
FBReactNativeSpec: fe08c1cd7e2e205718d77ad14b34957cce949b58 FBReactNativeSpec: fe08c1cd7e2e205718d77ad14b34957cce949b58
Firebase: cd2ab85eec8170dc260186159f21072ecb679ad5 Firebase: cd2ab85eec8170dc260186159f21072ecb679ad5
@ -863,14 +864,14 @@ SPEC CHECKSUMS:
RNCAsyncStorage: ea6b5c280997b2b32a587793163b1f10e580c4f7 RNCAsyncStorage: ea6b5c280997b2b32a587793163b1f10e580c4f7
RNFastImage: 1f2cab428712a4baaf78d6169eaec7f622556dd7 RNFastImage: 1f2cab428712a4baaf78d6169eaec7f622556dd7
RNGestureHandler: e5c7cab5f214503dcefd6b2b0cefb050e1f51c4a RNGestureHandler: e5c7cab5f214503dcefd6b2b0cefb050e1f51c4a
RNReanimated: 569c269480a76e39196aa17a5df08ef1561db5ff RNReanimated: da3860204e5660c0dd66739936732197d359d753
RNScreens: 522705f2e5c9d27efb17f24aceb2bf8335bc7b8e RNScreens: 522705f2e5c9d27efb17f24aceb2bf8335bc7b8e
RNSentry: 97bc62fa65b7d663daee16fbf9771470852217cf RNSentry: 97bc62fa65b7d663daee16fbf9771470852217cf
RNSVG: 551acb6562324b1d52a4e0758f7ca0ec234e278f RNSVG: 551acb6562324b1d52a4e0758f7ca0ec234e278f
SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d
SDWebImageWebPCoder: f93010f3f6c031e2f8fb3081ca4ee6966c539815 SDWebImageWebPCoder: f93010f3f6c031e2f8fb3081ca4ee6966c539815
Sentry: 0718c3ad7a08e1107599610795adaf08864102f3 Sentry: 0718c3ad7a08e1107599610795adaf08864102f3
UMTaskManagerInterface: 5654c50e68af11b19b9d05452bacf23d19b3f30f UMTaskManagerInterface: 6f7150f9ec9bc6f2760eeae532a70de71ff951c1
Yoga: e7dc4e71caba6472ff48ad7d234389b91dadc280 Yoga: e7dc4e71caba6472ff48ad7d234389b91dadc280
PODFILE CHECKSUM: 9bf9d386bac4ff98f76fc93f120c9922660384b5 PODFILE CHECKSUM: 9bf9d386bac4ff98f76fc93f120c9922660384b5

View File

@ -1,3 +1,4 @@
#import <Expo/Expo.h>
// //
// Use this file to import your target's public headers that you would like to expose to Swift. // Use this file to import your target's public headers that you would like to expose to Swift.
// //

View File

@ -51,17 +51,11 @@ static void InitializeFlipper(UIApplication *application) {
InitializeFlipper(application); InitializeFlipper(application);
#endif #endif
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; RCTBridge *bridge = [self.reactDelegate createBridgeWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"main" initialProperties:nil]; RCTRootView *rootView = [self.reactDelegate createRootViewWithBridge:bridge moduleName:@"main" initialProperties:nil];
id rootViewBackgroundColor = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"RCTRootViewBackgroundColor"]; rootView.backgroundColor = [UIColor whiteColor];
if (rootViewBackgroundColor != nil) {
rootView.backgroundColor = [RCTConvert UIColor:rootViewBackgroundColor];
} else {
rootView.backgroundColor = [UIColor whiteColor];
}
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new]; UIViewController *rootViewController = [self.reactDelegate createRootViewController];
rootViewController.view = rootView; rootViewController.view = rootView;
self.window.rootViewController = rootViewController; self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible]; [self.window makeKeyAndVisible];

View File

@ -35,35 +35,35 @@
"@react-navigation/native": "6.0.6", "@react-navigation/native": "6.0.6",
"@react-navigation/native-stack": "6.2.5", "@react-navigation/native-stack": "6.2.5",
"@react-navigation/stack": "6.0.11", "@react-navigation/stack": "6.0.11",
"@reduxjs/toolkit": "1.7.0", "@reduxjs/toolkit": "1.7.1",
"@sentry/react-native": "3.2.3", "@sentry/react-native": "3.2.3",
"@sharcoux/slider": "5.6.1", "@sharcoux/slider": "5.6.1",
"axios": "0.24.0", "axios": "0.24.0",
"expo": "43.0.4", "expo": "44.0.0",
"expo-auth-session": "3.4.2", "expo-auth-session": "3.5.0",
"expo-av": "10.1.3", "expo-av": "10.1.3",
"expo-constants": "^12.1.3", "expo-constants": "^13.0.0",
"expo-crypto": "10.0.3", "expo-crypto": "10.1.1",
"expo-device": "4.0.3", "expo-device": "4.1.0",
"expo-file-system": "^13.0.3", "expo-file-system": "13.1.0",
"expo-firebase-analytics": "5.0.3", "expo-firebase-analytics": "6.0.0",
"expo-haptics": "11.0.3", "expo-haptics": "11.1.0",
"expo-image-manipulator": "10.1.2", "expo-image-manipulator": "10.2.0",
"expo-image-picker": "11.0.3", "expo-image-picker": "12.0.1",
"expo-linking": "2.4.2", "expo-linking": "3.0.0",
"expo-localization": "11.0.0", "expo-localization": "12.0.0",
"expo-media-library": "^13.0.3", "expo-media-library": "^14.0.0",
"expo-notifications": "0.13.3", "expo-notifications": "0.14.0",
"expo-permissions": "13.0.3", "expo-permissions": "13.1.0",
"expo-random": "12.0.1", "expo-random": "12.1.1",
"expo-screen-capture": "4.0.3", "expo-screen-capture": "4.1.0",
"expo-secure-store": "11.0.3", "expo-secure-store": "11.1.0",
"expo-splash-screen": "0.13.5", "expo-splash-screen": "0.14.0",
"expo-status-bar": "1.1.0", "expo-status-bar": "1.2.0",
"expo-store-review": "5.0.3", "expo-store-review": "5.1.0",
"expo-updates": "0.10.15", "expo-updates": "0.11.1",
"expo-video-thumbnails": "6.0.3", "expo-video-thumbnails": "6.1.0",
"expo-web-browser": "10.0.3", "expo-web-browser": "10.1.0",
"i18next": "20.6.1", "i18next": "20.6.1",
"li": "1.3.0", "li": "1.3.0",
"lodash": "4.17.21", "lodash": "4.17.21",
@ -80,13 +80,13 @@
"react-native-gesture-handler": "2.1.0", "react-native-gesture-handler": "2.1.0",
"react-native-htmlview": "0.16.0", "react-native-htmlview": "0.16.0",
"react-native-pager-view": "5.4.9", "react-native-pager-view": "5.4.9",
"react-native-reanimated": "2.3.0", "react-native-reanimated": "2.3.1",
"react-native-safe-area-context": "3.3.2", "react-native-safe-area-context": "3.3.2",
"react-native-screens": "3.10.1", "react-native-screens": "3.10.1",
"react-native-svg": "12.1.1", "react-native-svg": "12.1.1",
"react-native-swipe-list-view": "3.2.9", "react-native-swipe-list-view": "3.2.9",
"react-native-tab-view": "3.1.1", "react-native-tab-view": "3.1.1",
"react-query": "3.34.3", "react-query": "3.34.5",
"react-redux": "7.2.6", "react-redux": "7.2.6",
"react-timeago": "6.2.1", "react-timeago": "6.2.1",
"redux-persist": "6.0.0", "redux-persist": "6.0.0",
@ -99,7 +99,7 @@
"@babel/core": "7.16.5", "@babel/core": "7.16.5",
"@babel/plugin-proposal-optional-chaining": "7.16.5", "@babel/plugin-proposal-optional-chaining": "7.16.5",
"@babel/preset-typescript": "7.16.5", "@babel/preset-typescript": "7.16.5",
"@expo/config": "6.0.13", "@expo/config": "6.0.14",
"@types/lodash": "4.14.178", "@types/lodash": "4.14.178",
"@types/react": "17.0.37", "@types/react": "17.0.37",
"@types/react-dom": "17.0.11", "@types/react-dom": "17.0.11",

View File

@ -0,0 +1,166 @@
diff --git a/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt b/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt
index 53bf40f..0ba5d89 100644
--- a/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt
+++ b/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt
@@ -56,6 +56,7 @@ import okhttp3.Callback
import okhttp3.Headers
import okhttp3.JavaNetCookieJar
import okhttp3.MediaType
+import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.MultipartBody
import okhttp3.OkHttpClient
import okhttp3.Request
@@ -63,11 +64,7 @@ import okhttp3.RequestBody
import okhttp3.Response
import okhttp3.ResponseBody
-import okio.Buffer
-import okio.BufferedSource
-import okio.ForwardingSource
-import okio.Okio
-import okio.Source
+import okio.*
import org.apache.commons.codec.binary.Hex
import org.apache.commons.codec.digest.DigestUtils
@@ -766,7 +763,7 @@ open class FileSystemModule(
}
val body = createRequestBody(options, decorator, fileUri.toFile())
- return requestBuilder.method(method, body).build()
+ return method?.let { requestBuilder.method(it, body).build() }
} catch (e: Exception) {
e.message?.let { Log.e(TAG, it) }
promise.reject(e)
@@ -791,7 +788,7 @@ open class FileSystemModule(
} ?: URLConnection.guessContentTypeFromName(file.name)
val fieldName = options["fieldName"]?.let { it as String } ?: file.name
- bodyBuilder.addFormDataPart(fieldName, file.name, decorator.decorate(RequestBody.create(MediaType.parse(mimeType), file)))
+ bodyBuilder.addFormDataPart(fieldName, file.name, decorator.decorate(RequestBody.create(mimeType.toMediaTypeOrNull(), file)))
bodyBuilder.build()
}
else -> {
@@ -816,9 +813,9 @@ open class FileSystemModule(
override fun onResponse(call: Call, response: Response) {
val result = Bundle().apply {
- putString("body", response.body()?.string())
- putInt("status", response.code())
- putBundle("headers", translateHeaders(response.headers()))
+ putString("body", response.body?.string())
+ putInt("status", response.code)
+ putBundle("headers", translateHeaders(response.headers))
}
response.close()
promise.resolve(result)
@@ -866,7 +863,7 @@ open class FileSystemModule(
taskHandlers[uuid] = TaskHandler(call)
call.enqueue(object : Callback {
override fun onFailure(call: Call, e: IOException) {
- if (call.isCanceled) {
+ if (call.isCanceled()) {
promise.resolve(null)
return
}
@@ -876,11 +873,11 @@ open class FileSystemModule(
override fun onResponse(call: Call, response: Response) {
val result = Bundle()
- val body = response.body()
+ val body = response.body
result.apply {
putString("body", body?.string())
- putInt("status", response.code())
- putBundle("headers", translateHeaders(response.headers()))
+ putInt("status", response.code)
+ putBundle("headers", translateHeaders(response.headers))
}
response.close()
promise.resolve(result)
@@ -900,10 +897,10 @@ open class FileSystemModule(
val resources = context.resources
val packageName = context.packageName
val resourceId = resources.getIdentifier(url, "raw", packageName)
- val bufferedSource = Okio.buffer(Okio.source(context.resources.openRawResource(resourceId)))
+ val bufferedSource = context.resources.openRawResource(resourceId).source().buffer()
val file = uri.toFile()
file.delete()
- val sink = Okio.buffer(Okio.sink(file))
+ val sink = file.sink().buffer()
sink.writeAll(bufferedSource)
sink.close()
val result = Bundle()
@@ -934,13 +931,13 @@ open class FileSystemModule(
override fun onResponse(call: Call, response: Response) {
val file = uri.toFile()
file.delete()
- val sink = Okio.buffer(Okio.sink(file))
- sink.writeAll(response.body()!!.source())
+ val sink = file.sink().buffer()
+ sink.writeAll(response.body!!.source())
sink.close()
val result = Bundle().apply {
putString("uri", Uri.fromFile(file).toString())
- putInt("status", response.code())
- putBundle("headers", translateHeaders(response.headers()))
+ putInt("status", response.code)
+ putBundle("headers", translateHeaders(response.headers))
if (options?.get("md5") == true) {
putString("md5", md5(file))
}
@@ -1003,7 +1000,7 @@ open class FileSystemModule(
?.addNetworkInterceptor { chain ->
val originalResponse = chain.proceed(chain.request())
originalResponse.newBuilder()
- .body(ProgressResponseBody(originalResponse.body(), progressListener))
+ .body(ProgressResponseBody(originalResponse.body, progressListener))
.build()
}
?.build()
@@ -1098,7 +1095,7 @@ open class FileSystemModule(
val options = params[0]?.options
return try {
val response = call!!.execute()
- val responseBody = response.body()
+ val responseBody = response.body
val input = BufferedInputStream(responseBody!!.byteStream())
val output = FileOutputStream(file, isResume == true)
val data = ByteArray(1024)
@@ -1108,15 +1105,15 @@ open class FileSystemModule(
}
val result = Bundle().apply {
putString("uri", Uri.fromFile(file).toString())
- putInt("status", response.code())
- putBundle("headers", translateHeaders(response.headers()))
+ putInt("status", response.code)
+ putBundle("headers", translateHeaders(response.headers))
options?.get("md5").takeIf { it == true }?.let { putString("md5", file?.let { md5(it) }) }
}
response.close()
promise?.resolve(result)
null
} catch (e: Exception) {
- if (call?.isCanceled == true) {
+ if (call?.isCanceled() == true) {
promise?.resolve(null)
return null
}
@@ -1139,7 +1136,7 @@ open class FileSystemModule(
override fun contentLength(): Long = responseBody?.contentLength() ?: -1
override fun source(): BufferedSource =
- bufferedSource ?: Okio.buffer(source(responseBody!!.source()))
+ bufferedSource ?: source(responseBody!!.source()).buffer()
private fun source(source: Source): Source {
return object : ForwardingSource(source) {
@@ -1304,7 +1301,7 @@ open class FileSystemModule(
// Copied out of React Native's `NetworkingModule.java`
private fun translateHeaders(headers: Headers): Bundle {
val responseHeaders = Bundle()
- for (i in 0 until headers.size()) {
+ for (i in 0 until headers.size) {
val headerName = headers.name(i)
// multiple values for the same header
if (responseHeaders[headerName] != null) {

File diff suppressed because one or more lines are too long

View File

@ -15,6 +15,8 @@ import * as Notifications from 'expo-notifications'
import * as SplashScreen from 'expo-splash-screen' import * as SplashScreen from 'expo-splash-screen'
import React, { useCallback, useEffect, useState } from 'react' import React, { useCallback, useEffect, useState } from 'react'
import { AppState, LogBox, Platform } from 'react-native' import { AppState, LogBox, Platform } from 'react-native'
import { GestureHandlerRootView } from 'react-native-gesture-handler'
import { enableFreeze } from 'react-native-screens'
import { QueryClientProvider } from 'react-query' import { QueryClientProvider } from 'react-query'
import { Provider } from 'react-redux' import { Provider } from 'react-redux'
import { PersistGate } from 'redux-persist/integration/react' import { PersistGate } from 'redux-persist/integration/react'
@ -28,6 +30,7 @@ dev()
sentry() sentry()
audio() audio()
push() push()
enableFreeze()
const App: React.FC = () => { const App: React.FC = () => {
log('log', 'App', 'rendering App') log('log', 'App', 'rendering App')
@ -101,15 +104,17 @@ const App: React.FC = () => {
) )
return ( return (
<QueryClientProvider client={queryClient}> <GestureHandlerRootView style={{ flex: 1 }}>
<Provider store={store}> <QueryClientProvider client={queryClient}>
<PersistGate <Provider store={store}>
persistor={persistor} <PersistGate
onBeforeLift={onBeforeLift} persistor={persistor}
children={children} onBeforeLift={onBeforeLift}
/> children={children}
</Provider> />
</QueryClientProvider> </Provider>
</QueryClientProvider>
</GestureHandlerRootView>
) )
} }

View File

@ -136,7 +136,7 @@ const Screens: React.FC<Props> = ({ localCorrupt }) => {
} }
if (previousRoute?.name !== currentRoute?.name) { if (previousRoute?.name !== currentRoute?.name) {
Analytics.setCurrentScreen(currentRoute?.name) Analytics.logEvent('screen_view', { screen_name: currentRoute?.name })
Sentry.Native.setContext('page', { Sentry.Native.setContext('page', {
previous: previousRoute, previous: previousRoute,
current: currentRoute current: currentRoute

View File

@ -21,6 +21,11 @@ export type Params = {
> >
} }
export type InstanceResponse<T = unknown> = {
body: T
links: { prev?: string; next?: string }
}
const apiInstance = async <T = unknown>({ const apiInstance = async <T = unknown>({
method, method,
version = 'v1', version = 'v1',
@ -29,7 +34,7 @@ const apiInstance = async <T = unknown>({
headers, headers,
body, body,
extras extras
}: Params): Promise<{ body: T; links: { prev?: string; next?: string } }> => { }: Params): Promise<InstanceResponse<T>> => {
const { store } = require('@root/store') const { store } = require('@root/store')
const state = store.getState() as RootState const state = store.getState() as RootState
const instanceActive = state.instances.instances.findIndex( const instanceActive = state.instances.instances.findIndex(

View File

@ -47,7 +47,6 @@ const TimelineTranslate = React.memo(
const [enabled, setEnabled] = useState(false) const [enabled, setEnabled] = useState(false)
const { refetch, data, isLoading, isSuccess, isError } = useTranslateQuery({ const { refetch, data, isLoading, isSuccess, isError } = useTranslateQuery({
uri: status.uri,
source: status.language, source: status.language,
target: settingsLanguage, target: settingsLanguage,
text, text,

View File

@ -31,7 +31,7 @@ const Tab = createBottomTabNavigator<ScreenTabsStackParamList>()
const ScreenTabs = React.memo( const ScreenTabs = React.memo(
({ navigation }: RootStackScreenProps<'Screen-Tabs'>) => { ({ navigation }: RootStackScreenProps<'Screen-Tabs'>) => {
const { mode, theme } = useTheme() const { theme } = useTheme()
const instanceActive = useSelector(getInstanceActive) const instanceActive = useSelector(getInstanceActive)
const instanceAccount = useSelector( const instanceAccount = useSelector(

View File

@ -10,9 +10,11 @@ import { Alert, StyleSheet } from 'react-native'
import FlashMessage from 'react-native-flash-message' import FlashMessage from 'react-native-flash-message'
import { ScrollView } from 'react-native-gesture-handler' import { ScrollView } from 'react-native-gesture-handler'
const TabMeProfileName: React.FC<TabMeProfileStackScreenProps< const TabMeProfileName: React.FC<
'Tab-Me-Profile-Name' TabMeProfileStackScreenProps<'Tab-Me-Profile-Name'> & {
> & { messageRef: RefObject<FlashMessage> }> = ({ messageRef: RefObject<FlashMessage>
}
> = ({
messageRef, messageRef,
route: { route: {
params: { display_name } params: { display_name }
@ -91,7 +93,8 @@ const TabMeProfileName: React.FC<TabMeProfileStackScreenProps<
options={{ options={{
maxLength: 30, maxLength: 30,
autoCapitalize: 'none', autoCapitalize: 'none',
autoCompleteType: 'username', autoComplete: 'username',
textContentType: 'username',
autoCorrect: false autoCorrect: false
}} }}
/> />

View File

@ -64,6 +64,7 @@ const SettingsApp: React.FC = () => {
cancelButtonIndex: options.length - 1 cancelButtonIndex: options.length - 1
}, },
buttonIndex => { buttonIndex => {
if (!buttonIndex) return
if (buttonIndex < options.length - 1) { if (buttonIndex < options.length - 1) {
analytics('settings_language_press', { analytics('settings_language_press', {
current: i18n.language, current: i18n.language,

View File

@ -32,9 +32,9 @@ export const mapFontsizeToName = (size: SettingsState['fontsize']) => {
} }
} }
const TabMeSettingsFontsize: React.FC<TabMeStackScreenProps< const TabMeSettingsFontsize: React.FC<
'Tab-Me-Settings-Fontsize' TabMeStackScreenProps<'Tab-Me-Settings-Fontsize'>
>> = () => { > = () => {
const { mode, theme } = useTheme() const { mode, theme } = useTheme()
const { t } = useTranslation('screenTabs') const { t } = useTranslation('screenTabs')
const initialSize = useSelector(getSettingsFontsize) const initialSize = useSelector(getSettingsFontsize)
@ -113,7 +113,12 @@ const TabMeSettingsFontsize: React.FC<TabMeStackScreenProps<
extraMarginLeft={-StyleConstants.Spacing.Global.PagePadding} extraMarginLeft={-StyleConstants.Spacing.Global.PagePadding}
extraMarginRight={-StyleConstants.Spacing.Global.PagePadding} extraMarginRight={-StyleConstants.Spacing.Global.PagePadding}
/> />
<TimelineDefault item={item} disableDetails disableOnPress /> <TimelineDefault
// @ts-ignore
item={item}
disableDetails
disableOnPress
/>
<ComponentSeparator <ComponentSeparator
extraMarginLeft={-StyleConstants.Spacing.Global.PagePadding} extraMarginLeft={-StyleConstants.Spacing.Global.PagePadding}
extraMarginRight={-StyleConstants.Spacing.Global.PagePadding} extraMarginRight={-StyleConstants.Spacing.Global.PagePadding}

View File

@ -18,9 +18,9 @@ import {
} from 'react-native' } from 'react-native'
import { Circle } from 'react-native-animated-spinkit' import { Circle } from 'react-native-animated-spinkit'
const TabSharedSearch: React.FC<TabSharedStackScreenProps< const TabSharedSearch: React.FC<
'Tab-Shared-Search' TabSharedStackScreenProps<'Tab-Shared-Search'>
>> = ({ > = ({
route: { route: {
params: { text } params: { text }
} }
@ -33,7 +33,13 @@ const TabSharedSearch: React.FC<TabSharedStackScreenProps<
hashtags: t('shared.search.sections.hashtags'), hashtags: t('shared.search.sections.hashtags'),
statuses: t('shared.search.sections.statuses') statuses: t('shared.search.sections.statuses')
} }
const { status, data } = useSearchQuery({ const { status, data } = useSearchQuery<
{
title: string
translation: string
data: any[]
}[]
>({
term: text, term: text,
options: { options: {
enabled: text !== undefined, enabled: text !== undefined,

View File

@ -33,24 +33,18 @@ const AccessibilityManager: React.FC = ({ children }) => {
useEffect(() => { useEffect(() => {
loadAccessibilityInfo() loadAccessibilityInfo()
AccessibilityInfo.addEventListener( const reduceMotionSubscription = AccessibilityInfo.addEventListener(
'reduceMotionChanged', 'reduceMotionChanged',
handleReduceMotionChanged handleReduceMotionChanged
) )
AccessibilityInfo.addEventListener( const screenReaderSubscription = AccessibilityInfo.addEventListener(
'screenReaderChanged', 'screenReaderChanged',
handleScreenReaderEnabled handleScreenReaderEnabled
) )
return () => { return () => {
AccessibilityInfo.removeEventListener( reduceMotionSubscription.remove()
'reduceMotionChanged', screenReaderSubscription.remove()
handleReduceMotionChanged
)
AccessibilityInfo.removeEventListener(
'screenReaderChanged',
handleScreenReaderEnabled
)
} }
}, []) }, [])

View File

@ -1,10 +1,10 @@
import apiInstance from '@api/instance' import apiInstance from '@api/instance'
import { AxiosError } from 'axios' import { AxiosError } from 'axios'
import { useQuery, UseQueryOptions } from 'react-query' import { QueryFunctionContext, useQuery, UseQueryOptions } from 'react-query'
export type QueryKeyAccount = ['Account', { id: Mastodon.Account['id'] }] export type QueryKeyAccount = ['Account', { id: Mastodon.Account['id'] }]
const queryFunction = ({ queryKey }: { queryKey: QueryKeyAccount }) => { const queryFunction = ({ queryKey }: QueryFunctionContext<QueryKeyAccount>) => {
const { id } = queryKey[1] const { id } = queryKey[1]
return apiInstance<Mastodon.Account>({ return apiInstance<Mastodon.Account>({
@ -13,11 +13,11 @@ const queryFunction = ({ queryKey }: { queryKey: QueryKeyAccount }) => {
}).then(res => res.body) }).then(res => res.body)
} }
const useAccountQuery = <TData = Mastodon.Account>({ const useAccountQuery = ({
options, options,
...queryKeyParams ...queryKeyParams
}: QueryKeyAccount[1] & { }: QueryKeyAccount[1] & {
options?: UseQueryOptions<Mastodon.Account, AxiosError, TData> options?: UseQueryOptions<Mastodon.Account, AxiosError>
}) => { }) => {
const queryKey: QueryKeyAccount = ['Account', { ...queryKeyParams }] const queryKey: QueryKeyAccount = ['Account', { ...queryKeyParams }]
return useQuery(queryKey, queryFunction, options) return useQuery(queryKey, queryFunction, options)

View File

@ -1,6 +1,7 @@
import apiInstance from '@api/instance' import apiInstance from '@api/instance'
import { AxiosError } from 'axios' import { AxiosError } from 'axios'
import { import {
QueryFunctionContext,
useMutation, useMutation,
UseMutationOptions, UseMutationOptions,
useQuery, useQuery,
@ -9,7 +10,9 @@ import {
type QueryKeyAnnouncement = ['Announcements', { showAll?: boolean }] type QueryKeyAnnouncement = ['Announcements', { showAll?: boolean }]
const queryFunction = ({ queryKey }: { queryKey: QueryKeyAnnouncement }) => { const queryFunction = ({
queryKey
}: QueryFunctionContext<QueryKeyAnnouncement>) => {
const { showAll } = queryKey[1] const { showAll } = queryKey[1]
return apiInstance<Mastodon.Announcement[]>({ return apiInstance<Mastodon.Announcement[]>({
@ -23,11 +26,11 @@ const queryFunction = ({ queryKey }: { queryKey: QueryKeyAnnouncement }) => {
}).then(res => res.body) }).then(res => res.body)
} }
const useAnnouncementQuery = <TData = Mastodon.Announcement[]>({ const useAnnouncementQuery = ({
options, options,
...queryKeyParams ...queryKeyParams
}: QueryKeyAnnouncement[1] & { }: QueryKeyAnnouncement[1] & {
options?: UseQueryOptions<Mastodon.Announcement[], AxiosError, TData> options?: UseQueryOptions<Mastodon.Announcement[], AxiosError>
}) => { }) => {
const queryKey: QueryKeyAnnouncement = [ const queryKey: QueryKeyAnnouncement = [
'Announcements', 'Announcements',

View File

@ -1,11 +1,11 @@
import apiGeneral from '@api/general' import apiGeneral from '@api/general'
import { AxiosError } from 'axios' import { AxiosError } from 'axios'
import * as AuthSession from 'expo-auth-session' import * as AuthSession from 'expo-auth-session'
import { useQuery, UseQueryOptions } from 'react-query' import { QueryFunctionContext, useQuery, UseQueryOptions } from 'react-query'
export type QueryKey = ['Apps', { domain?: string }] export type QueryKeyApps = ['Apps', { domain?: string }]
const queryFunction = ({ queryKey }: { queryKey: QueryKey }) => { const queryFunction = ({ queryKey }: QueryFunctionContext<QueryKeyApps>) => {
const redirectUri = AuthSession.makeRedirectUri({ const redirectUri = AuthSession.makeRedirectUri({
native: 'tooot://instance-auth', native: 'tooot://instance-auth',
useProxy: false useProxy: false
@ -27,13 +27,13 @@ const queryFunction = ({ queryKey }: { queryKey: QueryKey }) => {
}).then(res => res.body) }).then(res => res.body)
} }
const useAppsQuery = <TData = Mastodon.Apps>({ const useAppsQuery = ({
options, options,
...queryKeyParams ...queryKeyParams
}: QueryKey[1] & { }: QueryKeyApps[1] & {
options?: UseQueryOptions<Mastodon.Apps, AxiosError, TData> options?: UseQueryOptions<Mastodon.Apps, AxiosError>
}) => { }) => {
const queryKey: QueryKey = ['Apps', { ...queryKeyParams }] const queryKey: QueryKeyApps = ['Apps', { ...queryKeyParams }]
return useQuery(queryKey, queryFunction, options) return useQuery(queryKey, queryFunction, options)
} }

View File

@ -2,21 +2,22 @@ import apiInstance from '@api/instance'
import { AxiosError } from 'axios' import { AxiosError } from 'axios'
import { useQuery, UseQueryOptions } from 'react-query' import { useQuery, UseQueryOptions } from 'react-query'
type QueryKey = ['Emojis'] type QueryKeyEmojis = ['Emojis']
const queryFunction = () => { const queryFunction = async () => {
return apiInstance<Mastodon.Emoji[]>({ const res = await apiInstance<Mastodon.Emoji[]>({
method: 'get', method: 'get',
url: 'custom_emojis' url: 'custom_emojis'
}).then(res => res.body) })
return res.body
} }
const useEmojisQuery = <TData = Mastodon.Emoji[]>({ const useEmojisQuery = ({
options options
}: { }: {
options?: UseQueryOptions<Mastodon.Emoji[], AxiosError, TData> options?: UseQueryOptions<Mastodon.Emoji[], AxiosError>
}) => { }) => {
const queryKey: QueryKey = ['Emojis'] const queryKey: QueryKeyEmojis = ['Emojis']
return useQuery(queryKey, queryFunction, options) return useQuery(queryKey, queryFunction, options)
} }

View File

@ -1,10 +1,12 @@
import apiGeneral from '@api/general' import apiGeneral from '@api/general'
import { AxiosError } from 'axios' import { AxiosError } from 'axios'
import { useQuery, UseQueryOptions } from 'react-query' import { QueryFunctionContext, useQuery, UseQueryOptions } from 'react-query'
export type QueryKey = ['Instance', { domain?: string }] export type QueryKeyInstance = ['Instance', { domain?: string }]
const queryFunction = async ({ queryKey }: { queryKey: QueryKey }) => { const queryFunction = async ({
queryKey
}: QueryFunctionContext<QueryKeyInstance>) => {
const { domain } = queryKey[1] const { domain } = queryKey[1]
if (!domain) { if (!domain) {
return Promise.reject() return Promise.reject()
@ -18,19 +20,16 @@ const queryFunction = async ({ queryKey }: { queryKey: QueryKey }) => {
return res.body return res.body
} }
const useInstanceQuery = < const useInstanceQuery = ({
TData = Mastodon.Instance & { publicAllow?: boolean }
>({
options, options,
...queryKeyParams ...queryKeyParams
}: QueryKey[1] & { }: QueryKeyInstance[1] & {
options?: UseQueryOptions< options?: UseQueryOptions<
Mastodon.Instance & { publicAllow?: boolean }, Mastodon.Instance & { publicAllow?: boolean },
AxiosError, AxiosError
TData
> >
}) => { }) => {
const queryKey: QueryKey = ['Instance', { ...queryKeyParams }] const queryKey: QueryKeyInstance = ['Instance', { ...queryKeyParams }]
return useQuery(queryKey, queryFunction, options) return useQuery(queryKey, queryFunction, options)
} }

View File

@ -4,17 +4,18 @@ import { useQuery, UseQueryOptions } from 'react-query'
export type QueryKey = ['Lists'] export type QueryKey = ['Lists']
const queryFunction = () => { const queryFunction = async () => {
return apiInstance<Mastodon.List[]>({ const res = await apiInstance<Mastodon.List[]>({
method: 'get', method: 'get',
url: 'lists' url: 'lists'
}).then(res => res.body) })
return res.body
} }
const useListsQuery = <TData = Mastodon.List[]>({ const useListsQuery = ({
options options
}: { }: {
options?: UseQueryOptions<Mastodon.List[], AxiosError, TData> options?: UseQueryOptions<Mastodon.List[], AxiosError>
}) => { }) => {
const queryKey: QueryKey = ['Lists'] const queryKey: QueryKey = ['Lists']
return useQuery(queryKey, queryFunction, options) return useQuery(queryKey, queryFunction, options)

View File

@ -14,17 +14,18 @@ type AccountWithSource = Mastodon.Account &
type QueryKeyProfile = ['Profile'] type QueryKeyProfile = ['Profile']
const queryKey: QueryKeyProfile = ['Profile'] const queryKey: QueryKeyProfile = ['Profile']
const queryFunction = () => { const queryFunction = async () => {
return apiInstance<AccountWithSource>({ const res = await apiInstance<AccountWithSource>({
method: 'get', method: 'get',
url: `accounts/verify_credentials` url: `accounts/verify_credentials`
}).then(res => res.body) })
return res.body
} }
const useProfileQuery = <TData = AccountWithSource>({ const useProfileQuery = ({
options options
}: { }: {
options?: UseQueryOptions<AccountWithSource, AxiosError, TData> options?: UseQueryOptions<AccountWithSource, AxiosError>
}) => { }) => {
return useQuery(queryKey, queryFunction, options) return useQuery(queryKey, queryFunction, options)
} }

View File

@ -1,6 +1,7 @@
import apiInstance from '@api/instance' import apiInstance from '@api/instance'
import { AxiosError } from 'axios' import { AxiosError } from 'axios'
import { import {
QueryFunctionContext,
useMutation, useMutation,
UseMutationOptions, UseMutationOptions,
useQuery, useQuery,
@ -12,7 +13,9 @@ export type QueryKeyRelationship = [
{ id: Mastodon.Account['id'] } { id: Mastodon.Account['id'] }
] ]
const queryFunction = ({ queryKey }: { queryKey: QueryKeyRelationship }) => { const queryFunction = ({
queryKey
}: QueryFunctionContext<QueryKeyRelationship>) => {
const { id } = queryKey[1] const { id } = queryKey[1]
return apiInstance<Mastodon.Relationship[]>({ return apiInstance<Mastodon.Relationship[]>({

View File

@ -1,8 +1,8 @@
import apiInstance from '@api/instance' import apiInstance from '@api/instance'
import { AxiosError } from 'axios' import { AxiosError } from 'axios'
import { useQuery, UseQueryOptions } from 'react-query' import { QueryFunctionContext, useQuery, UseQueryOptions } from 'react-query'
export type QueryKey = [ export type QueryKeySearch = [
'Search', 'Search',
{ {
type?: 'accounts' | 'hashtags' | 'statuses' type?: 'accounts' | 'hashtags' | 'statuses'
@ -17,9 +17,11 @@ export type SearchResult = {
statuses: Mastodon.Status[] statuses: Mastodon.Status[]
} }
const queryFunction = ({ queryKey }: { queryKey: QueryKey }) => { const queryFunction = async ({
queryKey
}: QueryFunctionContext<QueryKeySearch>) => {
const { type, term, limit = 20 } = queryKey[1] const { type, term, limit = 20 } = queryKey[1]
return apiInstance<SearchResult>({ const res = await apiInstance<SearchResult>({
version: 'v2', version: 'v2',
method: 'get', method: 'get',
url: 'search', url: 'search',
@ -29,16 +31,17 @@ const queryFunction = ({ queryKey }: { queryKey: QueryKey }) => {
limit, limit,
resolve: true resolve: true
} }
}).then(res => res.body) })
return res.body
} }
const useSearchQuery = <TData = SearchResult>({ const useSearchQuery = <T = unknown>({
options, options,
...queryKeyParams ...queryKeyParams
}: QueryKey[1] & { }: QueryKeySearch[1] & {
options?: UseQueryOptions<SearchResult, AxiosError, TData> options?: UseQueryOptions<SearchResult, AxiosError, T>
}) => { }) => {
const queryKey: QueryKey = ['Search', { ...queryKeyParams }] const queryKey: QueryKeySearch = ['Search', { ...queryKeyParams }]
return useQuery(queryKey, queryFunction, options) return useQuery(queryKey, queryFunction, options)
} }

View File

@ -1,4 +1,4 @@
import apiInstance from '@api/instance' import apiInstance, { InstanceResponse } from '@api/instance'
import haptics from '@components/haptics' import haptics from '@components/haptics'
import queryClient from '@helpers/queryClient' import queryClient from '@helpers/queryClient'
import { store } from '@root/store' import { store } from '@root/store'
@ -7,6 +7,7 @@ import { AxiosError } from 'axios'
import { uniqBy } from 'lodash' import { uniqBy } from 'lodash'
import { import {
MutationOptions, MutationOptions,
QueryFunctionContext,
useInfiniteQuery, useInfiniteQuery,
UseInfiniteQueryOptions, UseInfiniteQueryOptions,
useMutation useMutation
@ -28,10 +29,7 @@ export type QueryKeyTimeline = [
const queryFunction = async ({ const queryFunction = async ({
queryKey, queryKey,
pageParam pageParam
}: { }: QueryFunctionContext<QueryKeyTimeline>) => {
queryKey: QueryKeyTimeline
pageParam?: { [key: string]: string }
}) => {
const { page, account, hashtag, list, toot } = queryKey[1] const { page, account, hashtag, list, toot } = queryKey[1]
let params: { [key: string]: string } = { ...pageParam } let params: { [key: string]: string } = { ...pageParam }
@ -191,21 +189,15 @@ const queryFunction = async ({
type Unpromise<T extends Promise<any>> = T extends Promise<infer U> ? U : never type Unpromise<T extends Promise<any>> = T extends Promise<infer U> ? U : never
export type TimelineData = Unpromise<ReturnType<typeof queryFunction>> export type TimelineData = Unpromise<ReturnType<typeof queryFunction>>
const useTimelineQuery = <TData = TimelineData>({ const useTimelineQuery = ({
options, options,
...queryKeyParams ...queryKeyParams
}: QueryKeyTimeline[1] & { }: QueryKeyTimeline[1] & {
options?: UseInfiniteQueryOptions< options?: UseInfiniteQueryOptions<
{ InstanceResponse<
body: Mastodon.Status[] | Mastodon.Notification[] | Mastodon.Conversation[]
| Mastodon.Status[] >,
| Mastodon.Notification[] AxiosError
| Mastodon.Conversation[]
links?: { prev?: string; next?: string }
pinned?: Mastodon.Status['id'][]
},
AxiosError,
TData
> >
}) => { }) => {
const queryKey: QueryKeyTimeline = ['Timeline', { ...queryKeyParams }] const queryKey: QueryKeyTimeline = ['Timeline', { ...queryKeyParams }]

View File

@ -1,7 +1,7 @@
import apiTooot from '@api/tooot' import apiTooot from '@api/tooot'
import haptics from '@components/haptics' import haptics from '@components/haptics'
import { AxiosError } from 'axios' import { AxiosError } from 'axios'
import { useQuery, UseQueryOptions } from 'react-query' import { QueryFunctionContext, useQuery, UseQueryOptions } from 'react-query'
type Translations = { type Translations = {
provider: string provider: string
@ -18,7 +18,9 @@ export type QueryKeyTranslate = [
} }
] ]
const queryFunction = async ({ queryKey }: { queryKey: QueryKeyTranslate }) => { const queryFunction = async ({
queryKey
}: QueryFunctionContext<QueryKeyTranslate>) => {
const { source, target, text } = queryKey[1] const { source, target, text } = queryKey[1]
const res = await apiTooot<Translations>({ const res = await apiTooot<Translations>({
@ -34,7 +36,7 @@ const useTranslateQuery = ({
options, options,
...queryKeyParams ...queryKeyParams
}: QueryKeyTranslate[1] & { }: QueryKeyTranslate[1] & {
options?: UseQueryOptions<Translations, AxiosError, Translations> options?: UseQueryOptions<Translations, AxiosError>
}) => { }) => {
const queryKey: QueryKeyTranslate = ['Translate', { ...queryKeyParams }] const queryKey: QueryKeyTranslate = ['Translate', { ...queryKeyParams }]
return useQuery(queryKey, queryFunction, { ...options, retry: false }) return useQuery(queryKey, queryFunction, { ...options, retry: false })

View File

@ -1,7 +1,11 @@
import apiInstance from '@api/instance' import apiInstance, { InstanceResponse } from '@api/instance'
import { TabSharedStackParamList } from '@utils/navigation/navigators' import { TabSharedStackParamList } from '@utils/navigation/navigators'
import { AxiosError } from 'axios' import { AxiosError } from 'axios'
import { useInfiniteQuery, UseInfiniteQueryOptions } from 'react-query' import {
QueryFunctionContext,
useInfiniteQuery,
UseInfiniteQueryOptions
} from 'react-query'
export type QueryKeyUsers = [ export type QueryKeyUsers = [
'Users', 'Users',
@ -11,10 +15,7 @@ export type QueryKeyUsers = [
const queryFunction = ({ const queryFunction = ({
queryKey, queryKey,
pageParam pageParam
}: { }: QueryFunctionContext<QueryKeyUsers>) => {
queryKey: QueryKeyUsers
pageParam?: { [key: string]: string }
}) => {
const { reference, id, type } = queryKey[1] const { reference, id, type } = queryKey[1]
let params: { [key: string]: string } = { ...pageParam } let params: { [key: string]: string } = { ...pageParam }
@ -30,15 +31,8 @@ const useUsersQuery = ({
...queryKeyParams ...queryKeyParams
}: QueryKeyUsers[1] & { }: QueryKeyUsers[1] & {
options?: UseInfiniteQueryOptions< options?: UseInfiniteQueryOptions<
{ InstanceResponse<Mastodon.Account[]>,
body: Mastodon.Account[] AxiosError
links?: { prev?: string; next?: string }
},
AxiosError,
{
body: Mastodon.Account[]
links?: { prev?: string; next?: string }
}
> >
}) => { }) => {
const queryKey: QueryKeyUsers = ['Users', { ...queryKeyParams }] const queryKey: QueryKeyUsers = ['Users', { ...queryKeyParams }]

View File

@ -99,7 +99,7 @@ const addInstance = createAsyncThunk(
mention: { loading: false, value: true }, mention: { loading: false, value: true },
poll: { loading: false, value: true } poll: { loading: false, value: true }
}, },
keys: undefined keys: { auth: undefined, public: undefined, private: undefined }
}, },
drafts: [] drafts: []
} }

2524
yarn.lock

File diff suppressed because it is too large Load Diff