Skip to content
This repository has been archived by the owner on Dec 21, 2024. It is now read-only.

SpeedrunHub v2 #85

Merged
merged 238 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
238 commits
Select commit Hold shift + click to select a range
22c5f59
migrated to expo SDK48
Asiern Apr 21, 2023
d51d457
created: speedruncom api hooks
Asiern Apr 24, 2023
1dafe89
add: loadInBrowser util
Asiern Apr 24, 2023
bae37b9
updated config object
Asiern Apr 24, 2023
011e0cc
removed: .lock; add: dist folder
Asiern Apr 24, 2023
56255f2
UI update
Asiern Apr 24, 2023
684b2bf
add: getPersonalBests hook
Asiern Apr 24, 2023
a6c47a9
merged selfProfile and Profile + updated Run component
Asiern Apr 24, 2023
17b857a
interface cleanup. Interfaces are now defined as types
Asiern Apr 24, 2023
f4d6d33
mv
Asiern Apr 26, 2023
0fdb0de
renamed: navigation & settings
Asiern Apr 26, 2023
9ff482c
Merge pull request #25 from Asiern/rename
Asiern Apr 26, 2023
1b8eee7
updated: speedruncom api types
Asiern Apr 30, 2023
c3adf3c
fix: getUsers response
Asiern Apr 30, 2023
1bf6a35
migrated config user type to api user type
Asiern Apr 30, 2023
59cbf97
moved: UserCard to components
Asiern Apr 30, 2023
c1e4c58
add: search filter components
Asiern May 1, 2023
a35d30f
add: square button
Asiern May 1, 2023
745bf7c
component optimization
Asiern May 1, 2023
141d8c9
add: getGames hook
Asiern May 1, 2023
f197b67
fix: missing config changes
Asiern May 1, 2023
c579055
updated: SearchBar component
Asiern May 1, 2023
7cbeac8
fix: SearchBar value not writale
Asiern May 1, 2023
41970fb
add: memoization
Asiern May 1, 2023
cb4b643
add: List bottom spacing
Asiern May 1, 2023
b89581a
add: pagination
Asiern May 1, 2023
e203641
updated: url
Asiern May 1, 2023
31ba9d3
add: gamesResponse type
Asiern May 1, 2023
e3cd645
updated: margins
Asiern May 1, 2023
e8a57bf
fix: pagination param
Asiern May 4, 2023
21e8505
fix: shadow overlapping
Asiern May 4, 2023
0ee1530
add: Game component
Asiern May 4, 2023
79710e5
fix: vertical shadow overlapping
Asiern May 4, 2023
6aa4245
add: games to search screen
Asiern May 4, 2023
8d2fa40
Merge pull request #26 from Asiern/search
Asiern May 4, 2023
4d52c1f
add: Poppins-Medium font
Asiern May 4, 2023
3e0e0b1
updated: statusbar margins
Asiern May 4, 2023
eaa2492
updated: login button icon
Asiern May 4, 2023
27e75f5
updated: About page to new context type
Asiern May 4, 2023
72a2f57
add: Settings screens to navigator
Asiern May 4, 2023
44a95d7
removed: unused screens
Asiern May 4, 2023
0510042
updated: Notifications settings
Asiern May 5, 2023
f1db737
removed: My Account
Asiern May 5, 2023
4a5b6d0
cleanup
Asiern May 5, 2023
3023f16
Merge pull request #29 from Asiern/23-settings-screen
Asiern May 5, 2023
080109b
cleanup
Asiern May 5, 2023
6850a86
Merge pull request #32 from Asiern/component-cleanup
Asiern May 5, 2023
3640261
add: TextInput icons
Asiern May 5, 2023
051b433
Merge pull request #34 from Asiern/27-textinput-icons
Asiern May 6, 2023
bdb3a08
removed: margins from button component
Asiern May 6, 2023
7f727c8
removed: unused component
Asiern May 6, 2023
3636439
fix: titles overflow from component #30
Asiern May 8, 2023
8af785d
Merge pull request #35 from Asiern/30-search-screen-game-titles-overf…
Asiern May 8, 2023
bc24aca
fix: item placemet should be top #31
Asiern May 8, 2023
529b4b7
Merge pull request #36 from Asiern/31-search-screen-item-placemet-sho…
Asiern May 8, 2023
3dd0d47
add: update command
Asiern May 8, 2023
156e1b3
feat: commit message linting with hisky following conventional commit…
Asiern May 9, 2023
a83eb41
docs: added git hooks setup and conventional commits badge
Asiern May 9, 2023
392d18d
Merge pull request #39 from Asiern/38-set-commit-standard
Asiern May 9, 2023
81e70c8
docs: fixed a path mentioned in project setup
Asiern May 9, 2023
185874d
feat: removed wcandillon eslint config
Asiern May 9, 2023
0b1aaab
feat: add lint script
Asiern May 9, 2023
18915a9
feat: add eslint ignore file
Asiern May 9, 2023
979207c
feat: add eslint git hook using husky
Asiern May 9, 2023
8ff2a1e
fix: linting errors
Asiern May 9, 2023
647c93f
Merge pull request #42 from Asiern/41-code-linting
Asiern May 9, 2023
ee9a910
fix: search screen props lint warnings
Asiern May 10, 2023
0ebeef9
fix: missing return type on function
Asiern May 10, 2023
e83ec46
fix: forbidden non-null assertion lint warning
Asiern May 10, 2023
9d535c2
fix: missing return type on function
Asiern May 10, 2023
604a81b
feat: jest testing
Asiern May 10, 2023
db107ca
feat: jest setup
Asiern May 10, 2023
a81fbb6
chore: ignore jest snapshots in .gitignore
Asiern May 10, 2023
067b5b9
chore: usercard tests
Asiern May 10, 2023
eeba20d
chore: squarebutton tests
Asiern May 10, 2023
cb5757b
chore: ignore jest coverage in .gitignore
Asiern May 10, 2023
2d5c849
chore: searchbar tests
Asiern May 10, 2023
7884434
chore: textinput tests
Asiern May 10, 2023
93fd571
feat: jest github action
Asiern May 11, 2023
15d20c1
Merge pull request #43 from Asiern/40-testing
Asiern May 11, 2023
9a3ded4
fix: usercard must get user as a prop and not it user from config
Asiern May 11, 2023
adc7483
fix: profile social components now get user as prop
Asiern May 12, 2023
df219a8
fix: usercard conutry name displaying config user values
Asiern May 12, 2023
ad13bc8
chore: add new variant (gray) to squarebutton
Asiern May 12, 2023
cc80d20
feat: profile screen
Asiern May 12, 2023
e9f6653
chore: add run and squarebutton to index
Asiern May 12, 2023
559293f
chore: run component player and place display
Asiern May 12, 2023
27509b1
chore: separated styles, added testids and tests for usercard
Asiern May 12, 2023
ef5aa7d
chore: removed unused profile components
Asiern May 12, 2023
085d0af
chore: add socialbutton tests
Asiern May 12, 2023
30662b4
Merge pull request #46 from Asiern/22-profile-screen
Asiern May 12, 2023
59ce062
chore: add icon renders test case for textinput component
Asiern May 12, 2023
d80535f
chore: fixed react navigation mock
Asiern May 12, 2023
34016cb
chore: add usercard on press test case
Asiern May 12, 2023
6979015
chore: moved data fetching logic to personalbestscontainer component
Asiern May 13, 2023
ab768c8
chore: created activity indicator component
Asiern May 13, 2023
6157c29
chore: useconfig hook tests
Asiern May 13, 2023
b986879
chore: fix linter warnings
Asiern May 13, 2023
ab963be
fix: navigate target screen name
Asiern May 13, 2023
517ad8e
chore: migrated HeaderButton to SquareButton
Asiern May 13, 2023
06b01ba
chore: homeheader tests
Asiern May 13, 2023
46c9dca
chore: run tests
Asiern May 13, 2023
54cf7d8
chore: updated jest action
Asiern May 13, 2023
fc79eee
chore: personalbest component tests
Asiern May 13, 2023
550bc74
chore: activityindicator component tests
Asiern May 13, 2023
63c60ff
fix: renamed HomeHeader test file
Asiern May 13, 2023
67a0bc6
chore: button component cleanup
Asiern May 13, 2023
625223c
chore: installed jest native library
Asiern May 13, 2023
4ed222f
chore: button component tests
Asiern May 13, 2023
f89c0e1
feat: workflow dispatch
Asiern May 13, 2023
c3a69eb
Create FUNDING.yml
Asiern May 15, 2023
456fcca
feat: home screen my games section
Asiern May 16, 2023
f4934ad
chore: gamecard tests
Asiern May 16, 2023
1b1ba5d
chore: add scrollindicator component
Asiern May 17, 2023
39661d8
chore: updated game gap
Asiern May 17, 2023
26470d3
feat: following users
Asiern May 17, 2023
51c7c97
chore: add filler view
Asiern May 19, 2023
3dbaf57
chore: return empty when slide number not greater than 1
Asiern May 19, 2023
1c4f9f3
chore: add ScrollIndicator tests
Asiern May 19, 2023
c00f4c9
chore: add notifications to home
Asiern May 20, 2023
77447f3
chore: updated login information states
Asiern May 20, 2023
05ad552
chore: add autosizing to user card
Asiern May 20, 2023
0d3ae34
feat: notifications screen
Asiern May 21, 2023
cdffd25
chore: add notification button to home screen + update tests
Asiern May 21, 2023
de61af1
feat: gamelist screen
Asiern May 21, 2023
e044f2a
chore: remove notification card
Asiern May 21, 2023
815a20a
fix: scroll indicator error when adding/removing games #50
Asiern May 23, 2023
45cc6aa
chore: linting
Asiern May 23, 2023
735fb31
chore: fix following list spacings
Asiern May 23, 2023
3ccd809
chore: migrated from dot to scrollindicator component
Asiern May 23, 2023
db8888c
chore: moved following user components to components folder
Asiern May 23, 2023
062e761
chore: linting
Asiern May 23, 2023
feb41b9
chore: add width when loading
Asiern May 23, 2023
74aa8d3
feat: following users
Asiern May 23, 2023
9020ed1
Merge pull request #52 from Asiern/20-home-screen
Asiern May 23, 2023
e22bf09
feat: show app version
Asiern May 23, 2023
eda29b4
feat: add user agent to api requests #51
Asiern May 23, 2023
6f50bc0
fix: searchbar on submit action
Asiern May 23, 2023
2909d99
fix: searchbar on submit action #53
Asiern May 23, 2023
14a6654
Merge branch 'v2' of github.com:Asiern/SpeedrunHub into v2
Asiern May 23, 2023
cc7c5d3
chore: moved screen header to components
Asiern May 24, 2023
c76e04e
chore: migrated to header component
Asiern May 24, 2023
2e4a2b0
feat: add back button to notification settings #56
Asiern May 24, 2023
2cb4016
fix: require cycle
Asiern May 24, 2023
ad671d6
chore: user tests
Asiern May 25, 2023
83af657
chore: header tests
Asiern May 25, 2023
c98759c
fix: expected version >=12. got 10.24.1 error
Asiern May 28, 2023
c30bb33
fix: expected version >=12. got 10.24.1 error
Asiern May 28, 2023
940db47
fix: expected version ">=14". got "12.22.12" error
Asiern May 28, 2023
31bf538
chore: add ci flag for jest
Asiern May 28, 2023
b3d5dfa
chore: add ci update snapshot flag
Asiern May 28, 2023
b25b64e
chore: set header title color
Asiern May 28, 2023
dcec4c4
chore: add getgame hook
Asiern May 28, 2023
f0ef7bd
chore: getplatform hook
Asiern May 28, 2023
d4442c7
chore: add disabled prop to gamecard
Asiern May 28, 2023
e27bc36
feat: game info component
Asiern May 28, 2023
db0b9fb
chore: add category hooks
Asiern May 28, 2023
534d7d7
chore: add style prop to button
Asiern May 28, 2023
4fab5fe
feat: game categories
Asiern May 28, 2023
b63585e
chore: add variables and leaderboard hooks
Asiern May 29, 2023
2afbc0b
chore: add game info variables
Asiern May 29, 2023
7008aab
chore: add game info leaderboard
Asiern May 29, 2023
0e394be
chore: add game info screen
Asiern May 29, 2023
6a9ed4a
chore: removed old game info components
Asiern May 29, 2023
6e4bad4
chore: migrated to header component
Asiern May 29, 2023
3a11297
Merge branch 'v2' into 49-gameinfo-app-crash
Asiern May 29, 2023
df6e6ed
Merge pull request #60 from Asiern/49-gameinfo-app-crash
Asiern May 29, 2023
ba99b20
fix: missing closing tag on header component
Asiern May 29, 2023
7fffc61
fix: add missing title
Asiern May 29, 2023
7d21b8e
feat: add on press action to title #59
Asiern May 29, 2023
de7c24c
chore: removed unused components
Asiern May 30, 2023
209d6ec
chore: add empty list component
Asiern May 30, 2023
da32b81
chore: add gamelist tests
Asiern May 30, 2023
0081b9e
chore: add search screen filter prop
Asiern May 30, 2023
ea76a3b
chore: add empty list component
Asiern May 30, 2023
0490a4a
feat: google admob support
Asiern May 31, 2023
e081c80
Merge pull request #63 from Asiern/ads
Asiern May 31, 2023
be548aa
feat: add to my games button #62
Asiern May 31, 2023
f373dc5
chore: linting
Asiern May 31, 2023
5ba21dc
chore: updated docs
Asiern May 31, 2023
1ec9130
chore: fix typos
Asiern May 31, 2023
92e7d69
chore: fix login button
Asiern May 31, 2023
8e3aca3
chore: updated privacy policy
Asiern Jun 1, 2023
c724311
chore: converted run to pure component
Asiern Jun 21, 2023
1f75fc0
chore: get users through leaderboard request
Asiern Jun 21, 2023
debf7d9
fix: guest users + japanese names
Asiern Jun 22, 2023
4282992
chore: moved like button to header
Asiern Jun 22, 2023
73f49ec
chore: flashlist installation
Asiern Jun 23, 2023
e77c386
chore: add shadow prop
Asiern Jun 23, 2023
a48fa86
chore: moved search button inside bar
Asiern Jun 23, 2023
6169a3a
chore: set height constant
Asiern Jun 23, 2023
2b2ce3f
chore: updated margin
Asiern Jun 23, 2023
1042b76
chore: updated empty component style
Asiern Jun 23, 2023
cf0b069
fix: improved leaderboard performance #61
Asiern Jun 23, 2023
05519da
chore: optimized run for memoization
Asiern Jun 24, 2023
f96aec2
chore: moved ad banner
Asiern Jun 24, 2023
711a4fa
chore: key extractor
Asiern Jun 24, 2023
476619b
chore: flipper + perf monitor support
Asiern Jun 24, 2023
3c78b70
docs: flipper setup
Asiern Jun 24, 2023
014695b
docs: updated
Asiern Jun 24, 2023
6895532
chore: flipper plugin
Asiern Jun 25, 2023
12b6f90
chore: update preview build
Asiern Jun 25, 2023
914df68
feat: crashlytics setup
Asiern Jun 25, 2023
e481fb8
chore: crashlytics
Asiern Jun 25, 2023
89b33b5
feat: privacy & safety screen
Asiern Jun 25, 2023
55a1daf
Merge pull request #68 from Asiern/crashlytics
Asiern Jun 25, 2023
c7f7ab8
chore: add google services file to gitignore
Asiern Jun 25, 2023
e887200
chore: add button disabled and iconPosition props
Asiern Jun 27, 2023
769213d
chore: add crashlytics logs
Asiern Jun 27, 2023
380c44a
chore: update default config
Asiern Jun 27, 2023
ee3b2f5
feat: onboarding
Asiern Jun 27, 2023
2da0ebb
Merge pull request #69 from Asiern/onboarding
Asiern Jun 27, 2023
835f2e6
fix: error caused by calling crashlytics from UI
Asiern Jun 27, 2023
ff03a0e
chore: removed development button
Asiern Jun 27, 2023
a761baa
chore: get proper app version
Asiern Jun 27, 2023
64a8ae6
chore: config updater between app versions
Asiern Jun 27, 2023
361930f
chore: add button props
Asiern Jun 28, 2023
3ceff06
chore: screen reader labels
Asiern Jun 28, 2023
8c31c7e
chore: increased pressable area
Asiern Jun 28, 2023
13b10d7
chore: add eas pre install hook
Asiern Jun 28, 2023
33f55e8
chore(deps): bump fast-xml-parser from 4.2.2 to 4.2.5
dependabot[bot] Jun 28, 2023
de9eba8
feat: i18next setup
Asiern Jun 30, 2023
df42202
chore: set buttonProps type
Asiern Jun 30, 2023
2bb4929
chore: add .vscode
Asiern Jun 30, 2023
dd4827f
chore: set i18n translations
Asiern Jun 30, 2023
ba35d06
chore: i18n testing setup
Asiern Jun 30, 2023
bf9888d
fix: test error caused by missing i18n configuration in test environment
Asiern Jun 30, 2023
9bda2b1
fix: typo error
Asiern Jun 30, 2023
5c2570b
Merge pull request #77 from Asiern/58-add-support-for-i18next-transla…
Asiern Jun 30, 2023
95d14d5
Merge pull request #76 from Asiern/dependabot/npm_and_yarn/fast-xml-p…
Asiern Jul 1, 2023
3aa4fbf
fix: #71 notifications screen layout
Asiern Jul 1, 2023
b927312
chore: updated notifications settings layout
Asiern Jul 1, 2023
a124d5c
chore: onboarding locales
Asiern Jul 3, 2023
48608ea
chore: updated name
Asiern Jul 4, 2023
9e0f963
Merge pull request #78 from Asiern/33-migrate-from-expo-app-loading-t…
Asiern Jul 4, 2023
23d4f5d
chore: removed old onboarding assets
Asiern Jul 4, 2023
009611f
feat(i18n): add section for adding more languages
Asiern Jul 4, 2023
33a2998
feat: introduce breaking changes for v2.0 release
Asiern Dec 19, 2023
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
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*js
dist
3 changes: 1 addition & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"react-native-wcandillon"
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
Expand Down
13 changes: 13 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: asiern
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
24 changes: 24 additions & 0 deletions .github/workflows/jest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Jest Tests on Pull Request

on:
pull_request:
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Node setup
uses: actions/setup-node@v1
with:
node-version: 18

- name: Install dependencies
run: yarn

- name: Run Jest tests
run: yarn test --ci --updateSnapshot
15 changes: 13 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ buck-out/
# Expo
.expo/*
web-build/
dist
android

#Lock files
yarn.lock
# Jest
*.snap
coverage

# Obsidian
.obsidian

# Google services
google-services.json

.vscode
5 changes: 5 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit ${1}
yarn lint
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
209 changes: 147 additions & 62 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -1,80 +1,165 @@
import React, { useState, useEffect } from "react";
import React, { useState } from "react";
import AsyncStorage from "@react-native-async-storage/async-storage";
import { ActivityIndicator } from "react-native";
import crashlytics from "@react-native-firebase/crashlytics";
import { version } from "./package.json";

// Translations (i18n)
import "./app/locale/i18n";

//Themes
import { Theme } from "./app/themes/DefaultTheme";
// TODO Migrate from expo-app-loading to expo-splash-screen
import AppLoading from "expo-app-loading";

// Fonts
import { loadAsync } from "expo-font";

// Splash screen
import * as SplashScreen from "expo-splash-screen";
SplashScreen.preventAutoHideAsync();

//Screens
import Navigation from "./app/Navigation/Navigation";
import { context, config } from "./app/config/config";
import Navigation from "./app/navigation/Navigation";
import { context, defaultConfig } from "./app/config/config";
import { StatusBar } from "expo-status-bar";
import { config } from "./app/types";

export default function App() {
const [loading, setLoading] = useState(true);
export default function App(): JSX.Element {
const [appIsReady, setAppIsReady] = useState<boolean>(false);
const [initialRoute, setInitialRoute] = useState("Onboarding");
const [theme, setTheme] = useState(Theme);
const [games, setGames] = useState([]);
const [Config, setConfig] = useState(config);
useEffect(() => {
let mounted = true;
if (mounted) {
(async () => {
const THEME = await AsyncStorage.getItem("@Theme");
const CONF = await AsyncStorage.getItem("@Config");
const GAMES = await AsyncStorage.getItem("@MyGames");
var CONFIG;
//Load Config
if (CONF === null) {
await AsyncStorage.setItem("@Config", JSON.stringify(config));
CONFIG = config;
setConfig(config);
} else {
CONFIG = JSON.parse(CONF);
setConfig(JSON.parse(CONF));
const [config, setConfig] = useState<config>(defaultConfig);

/**
* Update config state and async storage values
* @param config config object
*/
async function updateConfig(config: config) {
await AsyncStorage.setItem("@Config", JSON.stringify(config));
setConfig({ ...config });
}

// const onLayoutRootView = useCallback(async () => {
// if (appIsReady) await SplashScreen.hideAsync();
// }, [appIsReady]);

const prepare = async () => {
try {
crashlytics().log("AppLoading");
await SplashScreen.preventAutoHideAsync();
await loadAsync({
Poppins: require("./app/assets/fonts/Poppins-Regular.ttf"),
"Poppins-Medium": require("./app/assets/fonts/Poppins-Medium.ttf"),
});
crashlytics().log("AppLoading: Fonts loaded");

// Read config from AsyncStorage
let CONFIG: string | null = await AsyncStorage.getItem("@Config");
crashlytics().log("AppLoading: Config loaded");

// Config null => load default config
if (CONFIG === null) {
crashlytics().log("AppLoading: Config null => load default config");
await AsyncStorage.setItem(
"@Config",
JSON.stringify({ ...config, version })
);
}

// Read config from storage
CONFIG = await AsyncStorage.getItem("@Config");
crashlytics().log("AppLoading: Config loaded from storage");
const confObj: config = CONFIG ? JSON.parse(CONFIG) : config;

// Check if config version is outdated and update it
if (confObj.version !== version) {
crashlytics().log("AppLoading: Config version outdated");
confObj.version = version;
// Check if new version is compatible with old config
if (confObj.theme === undefined) {
crashlytics().log("AppLoading: Config version outdated");
confObj.theme = defaultConfig.theme;
}
if (confObj.google === undefined) {
crashlytics().log("AppLoading: Config version outdated");
confObj.google = defaultConfig.google;
}
if (confObj.accepted === undefined) {
crashlytics().log("AppLoading: Config version outdated");
confObj.accepted = defaultConfig.accepted;
}
//Load Theme
if (THEME === null) {
await AsyncStorage.setItem("@Theme", JSON.stringify(Theme));
setTheme(Theme);
} else {
setTheme(JSON.parse(THEME));
if (confObj.notifications === undefined) {
crashlytics().log("AppLoading: Config version outdated");
confObj.notifications = defaultConfig.notifications;
}
//Load Games
if (GAMES === null) {
await AsyncStorage.setItem("@MyGames", JSON.stringify(games));
setGames([]);
} else {
setGames(JSON.parse(GAMES));
if (confObj.logged === undefined) {
crashlytics().log("AppLoading: Config version outdated");
confObj.logged = defaultConfig.logged;
}
//Load Route
var route = "";
if (CONFIG.onboarding !== true) {
route = "Onboarding";
} else if (CONFIG.user.logged !== true) {
route = "Login";
} else {
route = "Main";
if (confObj.onboarding === undefined) {
crashlytics().log("AppLoading: Config version outdated");
confObj.onboarding = defaultConfig.onboarding;
}
setInitialRoute(route);
setLoading(false);
})();
if (confObj.user === undefined) {
crashlytics().log("AppLoading: Config version outdated");
confObj.user = defaultConfig.user;
}
if (confObj.key === undefined) {
crashlytics().log("AppLoading: Config version outdated");
confObj.key = defaultConfig.key;
}
if (confObj.games === undefined) {
crashlytics().log("AppLoading: Config version outdated");
confObj.games = defaultConfig.games;
}
if (confObj.following === undefined) {
crashlytics().log("AppLoading: Config version outdated");
confObj.following = defaultConfig.following;
}
}

// Update config state
setConfig(confObj);

// Set initial route
if (confObj.onboarding !== true) {
setInitialRoute("Onboarding");
} else if (confObj.logged !== true) {
setInitialRoute("Login");
} else {
setInitialRoute("Main");
}
} catch (e) {
crashlytics().recordError(e);
console.warn(e);
} finally {
crashlytics().log("AppLoading finished");
setAppIsReady(true);
await SplashScreen.hideAsync();
}
};

return function cleanup() {
mounted = false;
};
}, []);
const handleLoadingError = (error) => {
crashlytics().recordError(error);
console.warn(error);
};

if (loading) {
return <ActivityIndicator />;
} else {
if (!appIsReady) {
return (
<context.Provider
value={{ theme, setTheme, Config, setConfig, games, setGames }}
>
<Navigation initialRoute={initialRoute} />
</context.Provider>
<AppLoading
startAsync={prepare}
onError={handleLoadingError}
onFinish={() => setAppIsReady(true)}
/>
);
}

return (
<>
<StatusBar
style={"dark"}
backgroundColor={config.theme.colors.background}
/>
<context.Provider value={{ config, setConfig: updateConfig }}>
<Navigation initialRoute={initialRoute} />
</context.Provider>
</>
);
}
Loading
Loading