diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-03-13 16:01:43 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-13 16:01:43 -0500 |
commit | 56cf890debeb9872f791ccb992a5587f2c05fd9e (patch) | |
tree | 929453b41274a712d8b2fce441e98a0cd030d305 /android/app/src | |
parent | 503e03d91e1de4bfeabec1eb2d97dcdceb13fcc5 (diff) | |
download | voidsky-56cf890debeb9872f791ccb992a5587f2c05fd9e.tar.zst |
Move to expo and react-navigation (#288)
* WIP - adding expo * WIP - adding expo 2 * Fix tsc * Finish adding expo * Disable the 'require cycle' warning * Tweak plist * Modify some dependency versions to make expo happy * Fix icon fill * Get Web compiling for expo * 1.7 * Switch to react-navigation in expo2 (#287) * WIP Switch to react-navigation * WIP Switch to react-navigation 2 * WIP Switch to react-navigation 3 * Convert all screens to react navigation * Update BottomBar for react navigation * Update mobile menu to be react-native drawer * Fixes to drawer and bottombar * Factor out some helpers * Replace the navigation model with react-navigation * Restructure the shell folder and fix the header positioning * Restore the error boundary * Fix tsc * Implement not-found page * Remove react-native-gesture-handler (no longer used) * Handle notifee card presses * Handle all navigations from the state layer * Fix drawer behaviors * Fix two linking issues * Switch to our react-native-progress fork to fix an svg rendering issue * Get Web working with react-navigation * Refactor routes and navigation for a bit more clarity * Remove dead code * Rework Web shell to left/right nav to make this easier * Fix ViewHeader for desktop web * Hide profileheader back btn on desktop web * Move the compose button to the left nav * Implement reply prompt in threads for desktop web * Composer refactors * Factor out all platform-specific text input behaviors from the composer * Small fix * Update the web build to use tiptap for the composer * Tune up the mention autocomplete dropdown * Simplify the default avatar and banner * Fixes to link cards in web composer * Fix dropdowns on web * Tweak load latest on desktop * Add web beta message and feedback link * Fix up links in desktop web
Diffstat (limited to 'android/app/src')
-rw-r--r-- | android/app/src/debug/AndroidManifest.xml | 8 | ||||
-rw-r--r-- | android/app/src/debug/java/xyz/blueskyweb/app/ReactNativeFlipper.java (renamed from android/app/src/debug/java/com/app/ReactNativeFlipper.java) | 3 | ||||
-rw-r--r-- | android/app/src/main/AndroidManifest.xml | 82 | ||||
-rw-r--r-- | android/app/src/main/java/xyz/blueskyweb/app/MainActivity.java | 68 | ||||
-rw-r--r-- | android/app/src/main/java/xyz/blueskyweb/app/MainApplication.java | 76 | ||||
-rw-r--r-- | android/app/src/main/java/xyz/blueskyweb/pubsq/MainActivity.java | 36 | ||||
-rw-r--r-- | android/app/src/main/java/xyz/blueskyweb/pubsq/MainApplication.java | 65 | ||||
-rw-r--r-- | android/app/src/main/jni/Android.mk | 49 | ||||
-rw-r--r-- | android/app/src/release/java/xyz/blueskyweb/app/ReactNativeFlipper.java (renamed from android/app/src/release/java/com/xyz/blueskyweb/app/ReactNativeFlipper.java) | 0 |
9 files changed, 181 insertions, 206 deletions
diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml index 4b185bc15..99e38fc5f 100644 --- a/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -1,13 +1,7 @@ -<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"> <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> - <application - android:usesCleartextTraffic="true" - tools:targetApi="28" - tools:ignore="GoogleAppIndexingWarning"> - <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false" /> - </application> + <application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" /> </manifest> diff --git a/android/app/src/debug/java/com/app/ReactNativeFlipper.java b/android/app/src/debug/java/xyz/blueskyweb/app/ReactNativeFlipper.java index 2402f11b0..82fa1c1d4 100644 --- a/android/app/src/debug/java/com/app/ReactNativeFlipper.java +++ b/android/app/src/debug/java/xyz/blueskyweb/app/ReactNativeFlipper.java @@ -4,7 +4,7 @@ * <p>This source code is licensed under the MIT license found in the LICENSE file in the root * directory of this source tree. */ -package com.app; +package xyz.blueskyweb.app; import android.content.Context; import com.facebook.flipper.android.AndroidFlipperClient; @@ -17,7 +17,6 @@ import com.facebook.flipper.plugins.inspector.DescriptorMapping; import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; -import com.facebook.flipper.plugins.react.ReactFlipperPlugin; import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin; import com.facebook.react.ReactInstanceEventListener; import com.facebook.react.ReactInstanceManager; diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 1bee09d51..2582a5338 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,47 +1,35 @@ -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="xyz.blueskyweb.app"> - - <uses-permission android:name="android.permission.INTERNET" /> - <uses-permission android:name="android.permission.CAMERA"/> - <uses-permission android:name="android.permission.READ_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="false" - android:theme="@style/AppTheme"> - <activity - android:name=".MainActivity" - android:label="@string/app_name" - android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode" - android:launchMode="singleTask" - android:windowSoftInputMode="adjustPan" - android:exported="true"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - <!-- deep linking via web links --> - <intent-filter android:autoVerify="true"> - <action android:name="android.intent.action.VIEW" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.BROWSABLE" /> - <!-- debug host: https://bsky.pfrazee.com --> - <data android:scheme="https" /> - <data android:host="bsky.pfrazee.com" /> - </intent-filter> - <!-- deep linking via custom links --> - <intent-filter> - <action android:name="android.intent.action.VIEW" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.BROWSABLE" /> - <!-- debug scheme: bsky://app --> - <data android:scheme="bsky" /> - <data android:host="app" /> - </intent-filter> - </activity> - </application> -</manifest> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="xyz.blueskyweb.app"> + <uses-permission android:name="android.permission.INTERNET"/> + <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> + <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> + <uses-permission android:name="android.permission.VIBRATE"/> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> + <queries> + <intent> + <action android:name="android.intent.action.VIEW"/> + <category android:name="android.intent.category.BROWSABLE"/> + <data android:scheme="https"/> + </intent> + </queries> + <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:usesCleartextTraffic="true"> + <meta-data android:name="expo.modules.updates.ENABLED" android:value="true"/> + <meta-data android:name="expo.modules.updates.EXPO_SDK_VERSION" android:value="48.0.0"/> + <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"/> + <meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="https://exp.host/@arrygoo/bluesky"/> <!-- TODO --> + <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:exported="true" android:screenOrientation="portrait"> + <intent-filter> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> + </intent-filter> + <intent-filter> + <action android:name="android.intent.action.VIEW"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.BROWSABLE"/> + <data android:scheme="xyz.blueskyweb.app"/> + <data android:scheme="exp+bluesky"/> + </intent-filter> + </activity> + <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false"/> + </application> +</manifest> \ No newline at end of file diff --git a/android/app/src/main/java/xyz/blueskyweb/app/MainActivity.java b/android/app/src/main/java/xyz/blueskyweb/app/MainActivity.java new file mode 100644 index 000000000..0833f982d --- /dev/null +++ b/android/app/src/main/java/xyz/blueskyweb/app/MainActivity.java @@ -0,0 +1,68 @@ +package xyz.blueskyweb.app; + +import android.os.Build; +import android.os.Bundle; + +import com.facebook.react.ReactActivity; +import com.facebook.react.ReactActivityDelegate; +import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint; +import com.facebook.react.defaults.DefaultReactActivityDelegate; + +import expo.modules.ReactActivityDelegateWrapper; + +public class MainActivity extends ReactActivity { + @Override + protected void onCreate(Bundle savedInstanceState) { + // Set the theme to AppTheme BEFORE onCreate to support + // coloring the background, status bar, and navigation bar. + // This is required for expo-splash-screen. + setTheme(R.style.AppTheme); + super.onCreate(null); + } + + /** + * Returns the name of the main component registered from JavaScript. + * This is used to schedule rendering of the component. + */ + @Override + protected String getMainComponentName() { + return "main"; + } + + /** + * Returns the instance of the {@link ReactActivityDelegate}. Here we use a util class {@link + * DefaultReactActivityDelegate} which allows you to easily enable Fabric and Concurrent React + * (aka React 18) with two boolean flags. + */ + @Override + protected ReactActivityDelegate createReactActivityDelegate() { + return new ReactActivityDelegateWrapper(this, BuildConfig.IS_NEW_ARCHITECTURE_ENABLED, new DefaultReactActivityDelegate( + this, + getMainComponentName(), + // If you opted-in for the New Architecture, we enable the Fabric Renderer. + DefaultNewArchitectureEntryPoint.getFabricEnabled(), // fabricEnabled + // If you opted-in for the New Architecture, we enable Concurrent React (i.e. React 18). + DefaultNewArchitectureEntryPoint.getConcurrentReactEnabled() // concurrentRootEnabled + )); + } + + /** + * Align the back button behavior with Android S + * where moving root activities to background instead of finishing activities. + * @see <a href="https://developer.android.com/reference/android/app/Activity#onBackPressed()">onBackPressed</a> + */ + @Override + public void invokeDefaultOnBackPressed() { + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.R) { + if (!moveTaskToBack(false)) { + // For non-root activities, use the default implementation to finish them. + super.invokeDefaultOnBackPressed(); + } + return; + } + + // Use the default back button implementation on Android S + // because it's doing more than {@link Activity#moveTaskToBack} in fact. + super.invokeDefaultOnBackPressed(); + } +} diff --git a/android/app/src/main/java/xyz/blueskyweb/app/MainApplication.java b/android/app/src/main/java/xyz/blueskyweb/app/MainApplication.java new file mode 100644 index 000000000..38de2503d --- /dev/null +++ b/android/app/src/main/java/xyz/blueskyweb/app/MainApplication.java @@ -0,0 +1,76 @@ +package xyz.blueskyweb.app; + +import android.app.Application; +import android.content.res.Configuration; +import androidx.annotation.NonNull; + +import com.facebook.react.PackageList; +import com.facebook.react.ReactApplication; +import com.facebook.react.ReactNativeHost; +import com.facebook.react.ReactPackage; +import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint; +import com.facebook.react.defaults.DefaultReactNativeHost; +import com.facebook.soloader.SoLoader; + +import expo.modules.ApplicationLifecycleDispatcher; +import expo.modules.ReactNativeHostWrapper; + +import java.util.List; + +public class MainApplication extends Application implements ReactApplication { + + private final ReactNativeHost mReactNativeHost = + new ReactNativeHostWrapper(this, new DefaultReactNativeHost(this) { + @Override + public boolean getUseDeveloperSupport() { + return BuildConfig.DEBUG; + } + + @Override + protected List<ReactPackage> getPackages() { + @SuppressWarnings("UnnecessaryLocalVariable") + List<ReactPackage> packages = new PackageList(this).getPackages(); + // Packages that cannot be autolinked yet can be added manually here, for example: + // packages.add(new MyReactNativePackage()); + return packages; + } + + @Override + protected String getJSMainModuleName() { + return "index"; + } + + @Override + protected boolean isNewArchEnabled() { + return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED; + } + + @Override + protected Boolean isHermesEnabled() { + return BuildConfig.IS_HERMES_ENABLED; + } + }); + + @Override + public ReactNativeHost getReactNativeHost() { + return mReactNativeHost; + } + + @Override + public void onCreate() { + super.onCreate(); + SoLoader.init(this, /* native exopackage */ false); + if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { + // If you opted-in for the New Architecture, we load the native entry point for this app. + DefaultNewArchitectureEntryPoint.load(); + } + ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); + ApplicationLifecycleDispatcher.onApplicationCreate(this); + } + + @Override + public void onConfigurationChanged(@NonNull Configuration newConfig) { + super.onConfigurationChanged(newConfig); + ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig); + } +} diff --git a/android/app/src/main/java/xyz/blueskyweb/pubsq/MainActivity.java b/android/app/src/main/java/xyz/blueskyweb/pubsq/MainActivity.java deleted file mode 100644 index ed44ef8d7..000000000 --- a/android/app/src/main/java/xyz/blueskyweb/pubsq/MainActivity.java +++ /dev/null @@ -1,36 +0,0 @@ -package xyz.blueskyweb.app; - -import com.facebook.react.ReactActivity; -import com.facebook.react.ReactActivityDelegate; -import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint; -import com.facebook.react.defaults.DefaultReactActivityDelegate; -import android.os.Bundle; - -public class MainActivity extends ReactActivity { - - /** - * Returns the name of the main component registered from JavaScript. This is used to schedule - * rendering of the component. - */ - @Override - protected String getMainComponentName() { - return "xyz.blueskyweb.app"; - } - - /** - * Returns the instance of the {@link ReactActivityDelegate}. Here we use a util class {@link - * DefaultReactActivityDelegate} which allows you to easily enable Fabric and Concurrent React - * (aka React 18) with two boolean flags. - */ - @Override - protected ReactActivityDelegate createReactActivityDelegate() { - return new DefaultReactActivityDelegate( - this, - getMainComponentName(), - // If you opted-in for the New Architecture, we enable the Fabric Renderer. - DefaultNewArchitectureEntryPoint.getFabricEnabled(), // fabricEnabled - // If you opted-in for the New Architecture, we enable Concurrent React (i.e. React 18). - DefaultNewArchitectureEntryPoint.getConcurrentReactEnabled() // concurrentRootEnabled - ); - } -} diff --git a/android/app/src/main/java/xyz/blueskyweb/pubsq/MainApplication.java b/android/app/src/main/java/xyz/blueskyweb/pubsq/MainApplication.java deleted file mode 100644 index 34b34b0b2..000000000 --- a/android/app/src/main/java/xyz/blueskyweb/pubsq/MainApplication.java +++ /dev/null @@ -1,65 +0,0 @@ -package xyz.blueskyweb.app; - -import android.app.Application; -import com.facebook.react.PackageList; -import com.facebook.react.ReactApplication; -import com.facebook.react.ReactNativeHost; -import com.facebook.react.ReactPackage; -import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint; -import com.facebook.react.defaults.DefaultReactNativeHost; -import com.facebook.soloader.SoLoader; -import xyz.blueskyweb.app.newarchitecture.MainApplicationReactNativeHost; -import java.lang.reflect.InvocationTargetException; -import java.util.List; - -public class MainApplication extends Application implements ReactApplication { - - private final ReactNativeHost mReactNativeHost = - new DefaultReactNativeHost(this) { - @Override - public boolean getUseDeveloperSupport() { - return BuildConfig.DEBUG; - } - - @Override - protected List<ReactPackage> getPackages() { - @SuppressWarnings("UnnecessaryLocalVariable") - List<ReactPackage> packages = new PackageList(this).getPackages(); - // Packages that cannot be autolinked yet can be added manually here, for example: - // packages.add(new MyReactNativePackage()); - return packages; - } - - @Override - protected String getJSMainModuleName() { - return "index"; - } - - @Override - protected boolean isNewArchEnabled() { - return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED; - } - @Override - protected Boolean isHermesEnabled() { - return BuildConfig.IS_HERMES_ENABLED; - } - }; - - @Override - public ReactNativeHost getReactNativeHost() { - return mReactNativeHost; - } - - @Override - public void onCreate() { - super.onCreate(); - // If you opted-in for the New Architecture, we enable the TurboModule system - ReactFeatureFlags.useTurboModules = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED; - SoLoader.init(this, /* native exopackage */ false); - if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { - // If you opted-in for the New Architecture, we load the native entry point for this app. - DefaultNewArchitectureEntryPoint.load(); - } - ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); - } -} diff --git a/android/app/src/main/jni/Android.mk b/android/app/src/main/jni/Android.mk deleted file mode 100644 index b3099f122..000000000 --- a/android/app/src/main/jni/Android.mk +++ /dev/null @@ -1,49 +0,0 @@ -THIS_DIR := $(call my-dir) - -include $(REACT_ANDROID_DIR)/Android-prebuilt.mk - -# If you wish to add a custom TurboModule or Fabric component in your app you -# will have to include the following autogenerated makefile. -# include $(GENERATED_SRC_DIR)/codegen/jni/Android.mk -include $(CLEAR_VARS) - -LOCAL_PATH := $(THIS_DIR) - -# You can customize the name of your application .so file here. -LOCAL_MODULE := app_appmodules - -LOCAL_C_INCLUDES := $(LOCAL_PATH) -LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) -LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) - -# If you wish to add a custom TurboModule or Fabric component in your app you -# will have to uncomment those lines to include the generated source -# files from the codegen (placed in $(GENERATED_SRC_DIR)/codegen/jni) -# -# LOCAL_C_INCLUDES += $(GENERATED_SRC_DIR)/codegen/jni -# LOCAL_SRC_FILES += $(wildcard $(GENERATED_SRC_DIR)/codegen/jni/*.cpp) -# LOCAL_EXPORT_C_INCLUDES += $(GENERATED_SRC_DIR)/codegen/jni - -# Here you should add any native library you wish to depend on. -LOCAL_SHARED_LIBRARIES := \ - libfabricjni \ - libfbjni \ - libfolly_futures \ - libfolly_json \ - libglog \ - libjsi \ - libreact_codegen_rncore \ - libreact_debug \ - libreact_nativemodule_core \ - libreact_render_componentregistry \ - libreact_render_core \ - libreact_render_debug \ - libreact_render_graphics \ - librrc_view \ - libruntimeexecutor \ - libturbomodulejsijni \ - libyoga - -LOCAL_CFLAGS := -DLOG_TAG=\"ReactNative\" -fexceptions -frtti -std=c++17 -Wall - -include $(BUILD_SHARED_LIBRARY) diff --git a/android/app/src/release/java/com/xyz/blueskyweb/app/ReactNativeFlipper.java b/android/app/src/release/java/xyz/blueskyweb/app/ReactNativeFlipper.java index 2c66eae53..2c66eae53 100644 --- a/android/app/src/release/java/com/xyz/blueskyweb/app/ReactNativeFlipper.java +++ b/android/app/src/release/java/xyz/blueskyweb/app/ReactNativeFlipper.java |