Skip to content

Commit 0cfcbb4

Browse files
Merge pull request #5 from Nerimity/update-react
Update react
2 parents 2b02a51 + 75c6956 commit 0cfcbb4

60 files changed

Lines changed: 7975 additions & 16361 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
module.exports = {
22
root: true,
33
extends: '@react-native',
4-
rules: {
5-
radix: 0,
6-
},
74
};

.github/workflows/build-apk.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ name: build-apk
33
on:
44
push:
55
branches:
6-
- "**"
6+
- '**'
77
tags-ignore:
8-
- "v*"
8+
- 'v*'
99

1010
jobs:
1111
build:
1212
runs-on: ubuntu-latest
13-
container: node:20
13+
container: node:24
1414
steps:
1515
- uses: actions/checkout@v3
16-
16+
1717
- name: Set up our JDK environment # setup JDK environment: mandatory as we need to build android project
1818
uses: actions/setup-java@v3
1919
with:
@@ -30,12 +30,12 @@ jobs:
3030
- name: Make envfile
3131
uses: SpicyPizza/create-envfile@v1.3
3232
with:
33-
envkey_SERVER_URL: "https://nerimity.com"
34-
envkey_DEV_MODE: "false"
35-
envkey_APP_VERSION: "dev"
36-
envkey_TURNSTILE_SITEKEY: "0x4AAAAAAABO1ilip_YaVHJk"
37-
envkey_EMOJI_URL: "https://nerimity.com/twemojis/"
38-
envkey_NERIMITY_CDN: "https://cdn.nerimity.com/"
33+
envkey_SERVER_URL: 'https://nerimity.com'
34+
envkey_DEV_MODE: 'false'
35+
envkey_APP_VERSION: 'dev'
36+
envkey_TURNSTILE_SITEKEY: '0x4AAAAAAABO1ilip_YaVHJk'
37+
envkey_EMOJI_URL: 'https://nerimity.com/twemojis/'
38+
envkey_NERIMITY_CDN: 'https://cdn.nerimity.com/'
3939

4040
- name: Make Gradlew Executable
4141
run: cd android && chmod +x ./gradlew
@@ -44,7 +44,6 @@ jobs:
4444
run: |
4545
cd android && ./gradlew assembleRelease --no-daemon -PVERSION_NAME="dev"
4646
47-
4847
- name: Sign app APK
4948
uses: r0adkll/sign-android-release@v1
5049
# ID used to access action output
@@ -56,7 +55,7 @@ jobs:
5655
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
5756
keyPassword: ${{ secrets.KEY_PASSWORD }}
5857
env:
59-
BUILD_TOOLS_VERSION: "34.0.0"
58+
BUILD_TOOLS_VERSION: '35.0.0'
6059

6160
- name: Rename and move apk
6261
run: |

.github/workflows/tag-release.yml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,15 @@ name: tag-release
88
on:
99
push:
1010
tags:
11-
- "v*"
12-
11+
- 'v*'
1312

1413
jobs:
1514
build:
1615
runs-on: ubuntu-latest
17-
container: node:20
16+
container: node:24
1817
steps:
1918
- uses: actions/checkout@v3
20-
19+
2120
- name: Set up our JDK environment # setup JDK environment: mandatory as we need to build android project
2221
uses: actions/setup-java@v3
2322
with:
@@ -38,12 +37,12 @@ jobs:
3837
- name: Make envfile
3938
uses: SpicyPizza/create-envfile@v1.3
4039
with:
41-
envkey_SERVER_URL: "https://nerimity.com"
42-
envkey_DEV_MODE: "false"
40+
envkey_SERVER_URL: 'https://nerimity.com'
41+
envkey_DEV_MODE: 'false'
4342
envkey_APP_VERSION: ${{ steps.get_version.outputs.VERSION }}
44-
envkey_TURNSTILE_SITEKEY: "0x4AAAAAAABO1ilip_YaVHJk"
45-
envkey_EMOJI_URL: "https://nerimity.com/twemojis/"
46-
envkey_NERIMITY_CDN: "https://cdn.nerimity.com/"
43+
envkey_TURNSTILE_SITEKEY: '0x4AAAAAAABO1ilip_YaVHJk'
44+
envkey_EMOJI_URL: 'https://nerimity.com/twemojis/'
45+
envkey_NERIMITY_CDN: 'https://cdn.nerimity.com/'
4746

4847
- name: Make Gradlew Executable
4948
run: cd android && chmod +x ./gradlew
@@ -54,7 +53,6 @@ jobs:
5453
VERSION_NAME="${VERSION_NAME#v}"
5554
cd android && ./gradlew assembleRelease --no-daemon -PVERSION_NAME="$VERSION_NAME"
5655
57-
5856
- name: Sign app APK
5957
uses: r0adkll/sign-android-release@v1
6058
# ID used to access action output
@@ -66,18 +64,17 @@ jobs:
6664
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
6765
keyPassword: ${{ secrets.KEY_PASSWORD }}
6866
env:
69-
BUILD_TOOLS_VERSION: "34.0.0"
67+
BUILD_TOOLS_VERSION: '35.0.0'
7068

7169
- name: Rename and move apk
7270
run: |
7371
mv ${{steps.sign_app.outputs.signedReleaseFile}} $GITHUB_WORKSPACE/nerimity-${{ steps.get_version.outputs.VERSION }}.apk
7472
75-
7673
- name: Publish Draft Release
77-
uses: "marvinpinto/action-automatic-releases@latest"
74+
uses: 'marvinpinto/action-automatic-releases@latest'
7875
with:
79-
repo_token: "${{ secrets.GITHUB_TOKEN }}"
76+
repo_token: '${{ secrets.GITHUB_TOKEN }}'
8077
prerelease: false
8178
draft: false
8279
files: |
83-
nerimity-${{ steps.get_version.outputs.VERSION }}.apk
80+
nerimity-${{ steps.get_version.outputs.VERSION }}.apk

.prettierrc.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
module.exports = {
22
arrowParens: 'avoid',
3-
bracketSameLine: true,
4-
bracketSpacing: false,
53
singleQuote: true,
64
trailingComma: 'all',
7-
endOfLine:"auto"
85
};

.watchmanconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{}
1+
{}

App.tsx

Lines changed: 50 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
1-
import React, {useCallback, useEffect, useRef, useState} from 'react';
2-
import {Alert, AppState, BackHandler, Linking, Platform} from 'react-native';
1+
import React, { JSX, useCallback, useEffect, useRef, useState } from 'react';
2+
import {
3+
Alert,
4+
AppState,
5+
BackHandler,
6+
KeyboardAvoidingView,
7+
Linking,
8+
Platform,
9+
View,
10+
} from 'react-native';
311
import Show from './src/components/ui/Show';
412
import {
5-
currentUrl,
613
CustomWebView,
714
CustomWebViewRef,
815
} from './src/components/CustomWebView';
9-
import {CustomVideo, CustomVideoRef} from './src/components/ui/CustomVideo';
16+
import { CustomVideo, CustomVideoRef } from './src/components/ui/CustomVideo';
1017
import TrackPlayer from 'react-native-track-player';
1118

1219
import {
@@ -17,11 +24,11 @@ import {
1724
import messaging, {
1825
FirebaseMessagingTypes,
1926
} from '@react-native-firebase/messaging';
20-
import notifee, {EventType, Notification} from '@notifee/react-native';
21-
import {getLatestRelease, Release} from './src/githubApi';
27+
import notifee, { EventType, Notification } from '@notifee/react-native';
28+
import { getLatestRelease, Release } from './src/githubApi';
2229
import env from './src/env';
23-
import {dmChannelMatch, serverChannelMatch} from './src/UrlPatternMatchers';
24-
import {openDMChannelRequest} from './src/services/UserService';
30+
import { openDMChannelRequest } from './src/services/UserService';
31+
import { SafeAreaView } from 'react-native-safe-area-context';
2532

2633
TrackPlayer.setupPlayer();
2734

@@ -36,8 +43,8 @@ messaging().onMessage(e => onMessageReceived(e, false));
3643
messaging().setBackgroundMessageHandler(e => onMessageReceived(e, true));
3744

3845
let backgroundClickedNotification: Notification | undefined;
39-
notifee.onBackgroundEvent(async ({type, detail}) => {
40-
const {notification} = detail;
46+
notifee.onBackgroundEvent(async ({ type, detail }) => {
47+
const { notification } = detail;
4148
if (type === EventType.PRESS) {
4249
backgroundClickedNotification = notification;
4350
}
@@ -93,7 +100,7 @@ function App(): JSX.Element {
93100
});
94101

95102
const disposeForegroundEvent = notifee.onForegroundEvent(
96-
({type, detail}) => {
103+
({ type, detail }) => {
97104
if (type === EventType.PRESS) {
98105
handleNotificationClick(detail.notification);
99106
}
@@ -114,7 +121,9 @@ function App(): JSX.Element {
114121
}, [handleNotificationClick]);
115122

116123
const onAndroidBackPress = useCallback(() => {
124+
console.log('close 2');
117125
if (videoUrl) {
126+
console.log('close 1');
118127
videoRef.current?.stopVideo();
119128
return true;
120129
}
@@ -123,34 +132,41 @@ function App(): JSX.Element {
123132

124133
useEffect(() => {
125134
if (Platform.OS === 'android') {
126-
BackHandler.addEventListener('hardwareBackPress', onAndroidBackPress);
135+
const sub = BackHandler.addEventListener(
136+
'hardwareBackPress',
137+
onAndroidBackPress,
138+
);
127139
return () => {
128-
BackHandler.removeEventListener(
129-
'hardwareBackPress',
130-
onAndroidBackPress,
131-
);
140+
sub.remove();
132141
};
133142
}
134143
}, [onAndroidBackPress]);
135144

136145
return (
137-
<>
138-
<CustomWebView
139-
onAuthenticated={() => setAuthenticated(true)}
140-
ref={webViewRef}
141-
url={url || 'https://nerimity.com/login'}
142-
onVideoClick={setVideoUrl}
143-
/>
144-
<Show when={videoUrl}>
145-
<CustomVideo
146-
ref={videoRef}
147-
videoUrl={videoUrl!}
148-
onVideoEnd={() => {
149-
setVideoUrl(null);
150-
}}
151-
/>
152-
</Show>
153-
</>
146+
<View style={{ flex: 1, backgroundColor: 'black' }}>
147+
<SafeAreaView style={{ flex: 1 }}>
148+
<KeyboardAvoidingView
149+
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
150+
style={{ flex: 1 }}
151+
>
152+
<CustomWebView
153+
onAuthenticated={() => setAuthenticated(true)}
154+
ref={webViewRef}
155+
url={url || 'https://nerimity.com/login'}
156+
onVideoClick={setVideoUrl}
157+
/>
158+
<Show when={videoUrl}>
159+
<CustomVideo
160+
ref={videoRef}
161+
videoUrl={videoUrl!}
162+
onVideoEnd={() => {
163+
setVideoUrl(null);
164+
}}
165+
/>
166+
</Show>
167+
</KeyboardAvoidingView>
168+
</SafeAreaView>
169+
</View>
154170
);
155171
}
156172

@@ -167,7 +183,7 @@ function useUpdateChecker() {
167183
'Update Available',
168184
`Current: ${env.APP_VERSION}\nLatest: ${release.tag_name}`,
169185
[
170-
{text: 'Later'},
186+
{ text: 'Later' },
171187
{
172188
text: 'View Changelog',
173189
onPress: onViewChangelog,

Gemfile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@ source 'https://rubygems.org'
33
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
44
ruby ">= 2.6.10"
55

6-
# Cocoapods 1.15 introduced a bug which break the build. We will remove the upper
7-
# bound in the template on Cocoapods with next React Native release.
8-
gem 'cocoapods', '>= 1.13', '< 1.15'
9-
gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'
6+
# Exclude problematic versions of cocoapods and activesupport that causes build failures.
7+
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
8+
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
9+
gem 'xcodeproj', '< 1.26.0'
10+
gem 'concurrent-ruby', '< 1.3.4'
11+
12+
# Ruby 3.4.0 has removed some libraries from the standard library.
13+
gem 'bigdecimal'
14+
gem 'logger'
15+
gem 'benchmark'
16+
gem 'mutex_m'

__tests__/App-test.tsx

Lines changed: 0 additions & 14 deletions
This file was deleted.

__tests__/App.test.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* @format
3+
*/
4+
5+
import React from 'react';
6+
import ReactTestRenderer from 'react-test-renderer';
7+
import App from '../App';
8+
9+
test('renders correctly', async () => {
10+
await ReactTestRenderer.act(() => {
11+
ReactTestRenderer.create(<App />);
12+
});
13+
});

0 commit comments

Comments
 (0)