Skip to content

Commit

Permalink
Merge pull request #27 from tooot-app/development
Browse files Browse the repository at this point in the history
Added push notification
  • Loading branch information
xmflsct committed Mar 4, 2021
2 parents bbfe647 + cc02626 commit a6395cf
Show file tree
Hide file tree
Showing 143 changed files with 3,586 additions and 2,401 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Publish production
on:
push:
branches:
- production
- main
jobs:
publish:
runs-on: ubuntu-latest
Expand Down
30 changes: 7 additions & 23 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.xmflsct.app.tooot"
>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" package="com.xmflsct.app.tooot">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
Expand All @@ -12,30 +9,17 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="true"
android:theme="@style/AppTheme"
android:requestLegacyExternalStorage="true"
>
<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme" android:requestLegacyExternalStorage="true">
<!-- [Custom] Expo Notifications -->
<meta-data android:name="expo.modules.notifications.default_notification_icon" android:resource="@drawable/ic_stat_notifications" />
<!-- [Custom] End Expo Notifications -->
<meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="https://exp.host/@xmflsct/tooot"/>
<meta-data android:name="expo.modules.updates.EXPO_SDK_VERSION" android:value="${expoSDK}"/>
<meta-data android:name="expo.modules.updates.EXPO_RELEASE_CHANNEL" android:value="${releaseChannel}"/>
<meta-data android:name="expo.modules.updates.ENABLED" android:value="true"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize"
android:theme="@style/Theme.App.SplashScreen"
android:screenOrientation="portrait"
>
<activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public List<Package> getPackageList() {
new expo.modules.lineargradient.LinearGradientPackage(),
new expo.modules.localization.LocalizationPackage(),
new expo.modules.location.LocationPackage(),
new expo.modules.notifications.NotificationsPackage(),
new expo.modules.permissions.PermissionsPackage(),
new expo.modules.screencapture.ScreenCapturePackage(),
new expo.modules.securestore.SecureStorePackage(),
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export default (): ExpoConfig => ({
}
]
},
ios: {
bundleIdentifier: 'com.xmflsct.app.tooot'
},
android: {
versionCode: 4,
package: 'com.xmflsct.app.tooot',
Expand Down
19 changes: 8 additions & 11 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ensure_env_vars(
VERSIONS = read_json( json_path: "./package.json" )[:versions]
ENVIRONMENT = ENV["TOOOT_ENVIRONMENT"]
VERSION = "#{VERSIONS[:major]}.#{VERSIONS[:minor]}"
RELEASE_CHANNEL = "#{VERSIONS[:major]}-#{ENVIRONMENT}"
RELEASE_CHANNEL = "#{VERSIONS[:major]}-#{VERSIONS[:minor]}-#{ENVIRONMENT}"
BUILD_NUMBER = ENV["GITHUB_RUN_NUMBER"]
GITHUB_REPO = "tooot-app/app"
case ENVIRONMENT
Expand All @@ -27,6 +27,13 @@ EXPO_PLIST = "./ios/tooot/Supporting/Expo.plist"
desc "IOS: Prepare app store"
private_lane :prepare_appstore_ios do
set_info_plist_value( path: INFO_PLIST, key: "CFBundleShortVersionString", value: VERSION )
set_info_plist_value(
path: INFO_PLIST,
key: "NSAppTransportSecurity",
value: {
"NSAllowsArbitraryLoads" => false
}
)
increment_build_number( xcodeproj: XCODEPROJ, build_number: BUILD_NUMBER )
app_store_connect_api_key
end
Expand All @@ -37,15 +44,6 @@ private_lane :update_expo_ios do
set_info_plist_value( path: EXPO_PLIST, key: "EXUpdatesReleaseChannel", value: RELEASE_CHANNEL )
end

desc 'IOS: Upload dSYM'
lane :upload_symbols_ios do
download_dsyms
sentry_upload_dsym(
org_slug: ENV["SENTRY_ORGANIZATION"],
project_slug: ENV["SENTRY_PROJECT"]
)
end

desc "ANDROID: Prepare play store"
private_lane :prepare_playstore_android do
android_set_version_name( version_name: VERSION, gradle_file: "./android/app/build.gradle" )
Expand Down Expand Up @@ -93,7 +91,6 @@ private_lane :build_ios do
groups: "内测用户",
changelog: "Ready for testing"
)
# upload_symbols_ios
when "production"
prepare_appstore_ios
match( type: "appstore", readonly: true )
Expand Down
7 changes: 7 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ PODS:
- UMCore
- UMPermissionsInterface
- UMTaskManagerInterface
- EXNotifications (0.8.2):
- UMCore
- UMPermissionsInterface
- EXPermissions (10.0.0):
- UMCore
- UMPermissionsInterface
Expand Down Expand Up @@ -499,6 +502,7 @@ DEPENDENCIES:
- EXLinearGradient (from `../node_modules/expo-linear-gradient/ios`)
- EXLocalization (from `../node_modules/expo-localization/ios`)
- EXLocation (from `../node_modules/expo-location/ios`)
- EXNotifications (from `../node_modules/expo-notifications/ios`)
- EXPermissions (from `../node_modules/expo-permissions/ios`)
- EXRandom (from `../node_modules/expo-random/ios`)
- EXScreenCapture (from `../node_modules/expo-screen-capture/ios`)
Expand Down Expand Up @@ -622,6 +626,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/expo-localization/ios"
EXLocation:
:path: "../node_modules/expo-location/ios"
EXNotifications:
:path: "../node_modules/expo-notifications/ios"
EXPermissions:
:path: "../node_modules/expo-permissions/ios"
EXRandom:
Expand Down Expand Up @@ -769,6 +775,7 @@ SPEC CHECKSUMS:
EXLinearGradient: c803fbd1aa974be038177b1e45524bc35759fe9c
EXLocalization: 8b9463c81843da214476b541a27811dd885c9a76
EXLocation: d55e2a37f61bcfb4eba9c813b3f4621d896c4c00
EXNotifications: fba3319b1555961b99ddd185021b4c7ff978d5dd
EXPermissions: 17d4846ad1880f6891c74ae58ca1acb43e47ed47
EXRandom: d7e0f3dd64810aabd27d59f8ecffee359177e2c3
EXScreenCapture: 5b8447139e56e2b922e93ccdc7c773c103fb44fd
Expand Down
35 changes: 21 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
{
"name": "tooot",
"versions": {
"native": "210304",
"major": 0,
"minor": 6,
"patch": 0,
"expo": "40.0.0"
},
"description": "tooot app for Mastodon",
"author": "xmflsct <[email protected]>",
"license": "GPL-3.0-or-later",
"repository": {
"type": "git",
"url": "https://github.com/tooot-app/app.git"
},
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
Expand Down Expand Up @@ -34,6 +49,7 @@
"expo-linear-gradient": "~8.4.0",
"expo-linking": "~2.0.1",
"expo-localization": "~9.1.0",
"expo-notifications": "~0.8.2",
"expo-random": "~10.0.0",
"expo-screen-capture": "^3.0.0",
"expo-secure-store": "~9.3.0",
Expand All @@ -53,6 +69,7 @@
"react-native-blurhash": "^1.0.29",
"react-native-fast-image": "^8.3.4",
"react-native-feather": "^1.0.2",
"react-native-flash-message": "^0.1.23",
"react-native-gesture-handler": "~1.9.0",
"react-native-htmlview": "^0.16.0",
"react-native-reanimated": "^2.0.0-rc.2",
Expand All @@ -62,12 +79,10 @@
"react-native-swipe-list-view": "^3.2.6",
"react-native-tab-view": "^2.15.2",
"react-native-tab-view-viewpager-adapter": "^1.1.0",
"react-native-toast-message": "^1.4.3",
"react-native-unimodules": "~0.12.0",
"react-query": "^3.9.7",
"react-query": "^3.12.0",
"react-redux": "^7.2.2",
"react-timeago": "^5.2.0",
"reconnecting-websocket": "^4.4.0",
"redux-persist": "^6.0.0",
"rn-placeholder": "^3.0.3",
"sentry-expo": "^3.0.4",
Expand Down Expand Up @@ -102,15 +117,7 @@
"react-navigation": "^4.4.3",
"react-navigation-stack": "^2.10.2",
"react-test-renderer": "^16.13.1",
"typescript": "~4.1.3"
},
"private": true,
"name": "tooot",
"versions": {
"native": "210201",
"major": 0,
"minor": 5,
"patch": 0,
"expo": "40.0.0"
"typescript": "~4.1.3",
"uri-scheme": "^1.0.67"
}
}
}
13 changes: 13 additions & 0 deletions src/@types/mastodon.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,19 @@ declare namespace Mastodon {
'reading:expand:spoilers'?: boolean
}

type PushSubscription = {
id: string
endpoint: string
alerts: {
follow: boolean
favourite: boolean
reblog: boolean
mention: boolean
poll: boolean
}
server_key: string
}

type Relationship = {
id: string
following: boolean
Expand Down
2 changes: 1 addition & 1 deletion src/@types/react-navigation.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ declare namespace Nav {
title: Mastodon.List['title']
}
'Tab-Me-Settings': undefined
'Tab-Me-Settings-UpdateRemote': undefined
'Tab-Me-Settings-Push': undefined
'Tab-Me-Switch': undefined
} & TabSharedStackParamList
}
22 changes: 18 additions & 4 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,24 @@ import sentry from '@root/startup/sentry'
import { persistor, store } from '@root/store'
import { getSettingsLanguage } from '@utils/slices/settingsSlice'
import ThemeManager from '@utils/styles/ThemeManager'
import * as Notifications from 'expo-notifications'
import * as SplashScreen from 'expo-splash-screen'
import React, { useCallback, useEffect, useState } from 'react'
import { LogBox, Platform } from 'react-native'
import { AppState, LogBox, Platform } from 'react-native'
import { enableScreens } from 'react-native-screens'
import { QueryClient, QueryClientProvider } from 'react-query'
import { Provider } from 'react-redux'
import { PersistGate } from 'redux-persist/integration/react'
import push from './startup/push'

if (Platform.OS === 'android') {
LogBox.ignoreLogs(['Setting a timer for a long period of time'])
}
Platform.select({
android: LogBox.ignoreLogs(['Setting a timer for a long period of time'])
})

dev()
sentry()
audio()
push()
onlineStatus()

log('log', 'react-query', 'initializing')
Expand All @@ -37,6 +40,17 @@ const App: React.FC = () => {
log('log', 'App', 'rendering App')
const [localCorrupt, setLocalCorrupt] = useState<string>()

useEffect(() => {
AppState.addEventListener('change', () => {
Notifications.setBadgeCountAsync(0)
Notifications.dismissAllNotificationsAsync()
})

return () => {
AppState.removeEventListener('change', () => {})
}
}, [])

useEffect(() => {
const delaySplash = async () => {
log('log', 'App', 'delay splash')
Expand Down
Loading

0 comments on commit a6395cf

Please sign in to comment.