Răsfoiți Sursa

fix(android): crash on orientation change due to activity recreation (#6261)

Lucas Fernandes Nogueira 2 ani în urmă
părinte
comite
947eb391ca

+ 6 - 0
.changes/fix-orientation-crash.md

@@ -0,0 +1,6 @@
+---
+"cli.rs": patch
+"cli.js": patch
+---
+
+Update Android project template with fix to crash on orientation change.

+ 1 - 1
examples/api/src-tauri/Cargo.lock

@@ -4111,7 +4111,7 @@ dependencies = [
 [[package]]
 name = "wry"
 version = "0.27.0"
-source = "git+https://github.com/tauri-apps/wry?branch=dev#fc113d6e85ca5cd899c1f9c8c28a1e3c13612698"
+source = "git+https://github.com/tauri-apps/wry?branch=dev#9975dda12a122051b375ec6485650546d2d91c26"
 dependencies = [
  "base64 0.13.1",
  "block",

+ 3 - 0
tooling/cli/templates/mobile/android/app/src/main/AndroidManifest.xml

@@ -7,6 +7,9 @@
         android:theme="@style/Theme.{{snake-case app.name}}"
         android:usesCleartextTraffic="${usesCleartextTraffic}">
         <activity
+            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
+            android:launchMode="singleTask"
+            android:label="@string/main_activity_title"
             android:name=".MainActivity"
             android:exported="true">
             <intent-filter>

+ 1 - 0
tooling/cli/templates/mobile/android/app/src/main/res/values/strings.xml

@@ -1,3 +1,4 @@
 <resources>
     <string name="app_name">{{app.stylized-name}}</string>
+    <string name="main_activity_title">{{app.stylized-name}}</string>
 </resources>