Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 0 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
module.exports = {
root: true,
extends: '@react-native',
rules: {
radix: 0,
},
};
23 changes: 11 additions & 12 deletions .github/workflows/build-apk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ name: build-apk
on:
push:
branches:
- "**"
- '**'
tags-ignore:
- "v*"
- 'v*'

jobs:
build:
runs-on: ubuntu-latest
container: node:20
container: node:24
steps:
- uses: actions/checkout@v3

- name: Set up our JDK environment # setup JDK environment: mandatory as we need to build android project
uses: actions/setup-java@v3
with:
Expand All @@ -30,12 +30,12 @@ jobs:
- name: Make envfile
uses: SpicyPizza/create-envfile@v1.3
with:
envkey_SERVER_URL: "https://nerimity.com"
envkey_DEV_MODE: "false"
envkey_APP_VERSION: "dev"
envkey_TURNSTILE_SITEKEY: "0x4AAAAAAABO1ilip_YaVHJk"
envkey_EMOJI_URL: "https://nerimity.com/twemojis/"
envkey_NERIMITY_CDN: "https://cdn.nerimity.com/"
envkey_SERVER_URL: 'https://nerimity.com'
envkey_DEV_MODE: 'false'
envkey_APP_VERSION: 'dev'
envkey_TURNSTILE_SITEKEY: '0x4AAAAAAABO1ilip_YaVHJk'
envkey_EMOJI_URL: 'https://nerimity.com/twemojis/'
envkey_NERIMITY_CDN: 'https://cdn.nerimity.com/'

- name: Make Gradlew Executable
run: cd android && chmod +x ./gradlew
Expand All @@ -44,7 +44,6 @@ jobs:
run: |
cd android && ./gradlew assembleRelease --no-daemon -PVERSION_NAME="dev"


- name: Sign app APK
uses: r0adkll/sign-android-release@v1
# ID used to access action output
Expand All @@ -56,7 +55,7 @@ jobs:
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: "34.0.0"
BUILD_TOOLS_VERSION: '35.0.0'

- name: Rename and move apk
run: |
Expand Down
27 changes: 12 additions & 15 deletions .github/workflows/tag-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@ name: tag-release
on:
push:
tags:
- "v*"

- 'v*'

jobs:
build:
runs-on: ubuntu-latest
container: node:20
container: node:24
steps:
- uses: actions/checkout@v3

- name: Set up our JDK environment # setup JDK environment: mandatory as we need to build android project
uses: actions/setup-java@v3
with:
Expand All @@ -38,12 +37,12 @@ jobs:
- name: Make envfile
uses: SpicyPizza/create-envfile@v1.3
with:
envkey_SERVER_URL: "https://nerimity.com"
envkey_DEV_MODE: "false"
envkey_SERVER_URL: 'https://nerimity.com'
envkey_DEV_MODE: 'false'
envkey_APP_VERSION: ${{ steps.get_version.outputs.VERSION }}
envkey_TURNSTILE_SITEKEY: "0x4AAAAAAABO1ilip_YaVHJk"
envkey_EMOJI_URL: "https://nerimity.com/twemojis/"
envkey_NERIMITY_CDN: "https://cdn.nerimity.com/"
envkey_TURNSTILE_SITEKEY: '0x4AAAAAAABO1ilip_YaVHJk'
envkey_EMOJI_URL: 'https://nerimity.com/twemojis/'
envkey_NERIMITY_CDN: 'https://cdn.nerimity.com/'

- name: Make Gradlew Executable
run: cd android && chmod +x ./gradlew
Expand All @@ -54,7 +53,6 @@ jobs:
VERSION_NAME="${VERSION_NAME#v}"
cd android && ./gradlew assembleRelease --no-daemon -PVERSION_NAME="$VERSION_NAME"


- name: Sign app APK
uses: r0adkll/sign-android-release@v1
# ID used to access action output
Expand All @@ -66,18 +64,17 @@ jobs:
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: "34.0.0"
BUILD_TOOLS_VERSION: '35.0.0'

- name: Rename and move apk
run: |
mv ${{steps.sign_app.outputs.signedReleaseFile}} $GITHUB_WORKSPACE/nerimity-${{ steps.get_version.outputs.VERSION }}.apk


- name: Publish Draft Release
uses: "marvinpinto/action-automatic-releases@latest"
uses: 'marvinpinto/action-automatic-releases@latest'
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
repo_token: '${{ secrets.GITHUB_TOKEN }}'
prerelease: false
draft: false
files: |
nerimity-${{ steps.get_version.outputs.VERSION }}.apk
nerimity-${{ steps.get_version.outputs.VERSION }}.apk
3 changes: 0 additions & 3 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
module.exports = {
arrowParens: 'avoid',
bracketSameLine: true,
bracketSpacing: false,
singleQuote: true,
trailingComma: 'all',
endOfLine:"auto"
};
2 changes: 1 addition & 1 deletion .watchmanconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{}
{}
84 changes: 50 additions & 34 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import React, {useCallback, useEffect, useRef, useState} from 'react';
import {Alert, AppState, BackHandler, Linking, Platform} from 'react-native';
import React, { JSX, useCallback, useEffect, useRef, useState } from 'react';
import {
Alert,
AppState,
BackHandler,
KeyboardAvoidingView,
Linking,
Platform,
View,
} from 'react-native';
import Show from './src/components/ui/Show';
import {
currentUrl,
CustomWebView,
CustomWebViewRef,
} from './src/components/CustomWebView';
import {CustomVideo, CustomVideoRef} from './src/components/ui/CustomVideo';
import { CustomVideo, CustomVideoRef } from './src/components/ui/CustomVideo';
import TrackPlayer from 'react-native-track-player';

import {
Expand All @@ -17,11 +24,11 @@ import {
import messaging, {
FirebaseMessagingTypes,
} from '@react-native-firebase/messaging';
import notifee, {EventType, Notification} from '@notifee/react-native';
import {getLatestRelease, Release} from './src/githubApi';
import notifee, { EventType, Notification } from '@notifee/react-native';
import { getLatestRelease, Release } from './src/githubApi';
import env from './src/env';
import {dmChannelMatch, serverChannelMatch} from './src/UrlPatternMatchers';
import {openDMChannelRequest} from './src/services/UserService';
import { openDMChannelRequest } from './src/services/UserService';
import { SafeAreaView } from 'react-native-safe-area-context';

TrackPlayer.setupPlayer();

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

let backgroundClickedNotification: Notification | undefined;
notifee.onBackgroundEvent(async ({type, detail}) => {
const {notification} = detail;
notifee.onBackgroundEvent(async ({ type, detail }) => {
const { notification } = detail;
if (type === EventType.PRESS) {
backgroundClickedNotification = notification;
}
Expand Down Expand Up @@ -93,7 +100,7 @@ function App(): JSX.Element {
});

const disposeForegroundEvent = notifee.onForegroundEvent(
({type, detail}) => {
({ type, detail }) => {
if (type === EventType.PRESS) {
handleNotificationClick(detail.notification);
}
Expand All @@ -114,7 +121,9 @@ function App(): JSX.Element {
}, [handleNotificationClick]);

const onAndroidBackPress = useCallback(() => {
console.log('close 2');
if (videoUrl) {
console.log('close 1');
videoRef.current?.stopVideo();
return true;
}
Expand All @@ -123,34 +132,41 @@ function App(): JSX.Element {

useEffect(() => {
if (Platform.OS === 'android') {
BackHandler.addEventListener('hardwareBackPress', onAndroidBackPress);
const sub = BackHandler.addEventListener(
'hardwareBackPress',
onAndroidBackPress,
);
return () => {
BackHandler.removeEventListener(
'hardwareBackPress',
onAndroidBackPress,
);
sub.remove();
};
}
}, [onAndroidBackPress]);

return (
<>
<CustomWebView
onAuthenticated={() => setAuthenticated(true)}
ref={webViewRef}
url={url || 'https://nerimity.com/login'}
onVideoClick={setVideoUrl}
/>
<Show when={videoUrl}>
<CustomVideo
ref={videoRef}
videoUrl={videoUrl!}
onVideoEnd={() => {
setVideoUrl(null);
}}
/>
</Show>
</>
<View style={{ flex: 1, backgroundColor: 'black' }}>
<SafeAreaView style={{ flex: 1 }}>
<KeyboardAvoidingView
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
style={{ flex: 1 }}
>
<CustomWebView
onAuthenticated={() => setAuthenticated(true)}
ref={webViewRef}
url={url || 'https://nerimity.com/login'}
onVideoClick={setVideoUrl}
/>
<Show when={videoUrl}>
<CustomVideo
ref={videoRef}
videoUrl={videoUrl!}
onVideoEnd={() => {
setVideoUrl(null);
}}
/>
</Show>
</KeyboardAvoidingView>
</SafeAreaView>
</View>
);
}

Expand All @@ -167,7 +183,7 @@ function useUpdateChecker() {
'Update Available',
`Current: ${env.APP_VERSION}\nLatest: ${release.tag_name}`,
[
{text: 'Later'},
{ text: 'Later' },
{
text: 'View Changelog',
onPress: onViewChangelog,
Expand Down
15 changes: 11 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@ source 'https://rubygems.org'
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby ">= 2.6.10"

# Cocoapods 1.15 introduced a bug which break the build. We will remove the upper
# bound in the template on Cocoapods with next React Native release.
gem 'cocoapods', '>= 1.13', '< 1.15'
gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'
# Exclude problematic versions of cocoapods and activesupport that causes build failures.
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
gem 'xcodeproj', '< 1.26.0'
gem 'concurrent-ruby', '< 1.3.4'

# Ruby 3.4.0 has removed some libraries from the standard library.
gem 'bigdecimal'
gem 'logger'
gem 'benchmark'
gem 'mutex_m'
14 changes: 0 additions & 14 deletions __tests__/App-test.tsx

This file was deleted.

13 changes: 13 additions & 0 deletions __tests__/App.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* @format
*/

import React from 'react';
import ReactTestRenderer from 'react-test-renderer';
import App from '../App';

test('renders correctly', async () => {
await ReactTestRenderer.act(() => {
ReactTestRenderer.create(<App />);
});
});
Loading
Loading