From f95eadd3e641927f31731f558084e88d1243486a Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Mon, 7 Apr 2025 20:56:34 +0800 Subject: [PATCH] :bug: Fix bugs --- android/app/build.gradle | 2 + android/app/src/main/AndroidManifest.xml | 4 +- android/app/src/proguard-rules.pro | 91 +++++++++++++++++++++- assets/translations/en-US.json | 4 +- assets/translations/zh-CN.json | 4 +- lib/controllers/post_write_controller.dart | 1 + lib/screens/post/post_editor.dart | 12 +-- lib/widgets/markdown_content.dart | 2 +- 8 files changed, 107 insertions(+), 13 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 67b1be9..f6dccd7 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -10,6 +10,8 @@ plugins { } dependencies { + implementation 'com.facebook.fresco:webpsupport:2.6.0' + implementation 'com.facebook.react:react-android:0.75.5' implementation 'com.google.android.material:material:1.12.0' implementation 'androidx.glance:glance:1.1.1' implementation 'androidx.glance:glance-appwidget:1.1.1' diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 354b262..bbf239e 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,4 +1,4 @@ - + @@ -118,4 +118,4 @@ - \ No newline at end of file + diff --git a/android/app/src/proguard-rules.pro b/android/app/src/proguard-rules.pro index 8e1c115..4de8f33 100644 --- a/android/app/src/proguard-rules.pro +++ b/android/app/src/proguard-rules.pro @@ -11,4 +11,93 @@ -keepclassmembers class * { @com.google.gson.annotations.SerializedName ; -} \ No newline at end of file +} + +# React Native + +# Keep our interfaces so they can be used by other ProGuard rules. +# See http://sourceforge.net/p/proguard/bugs/466/ +-keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip +-keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters +-keep class com.facebook.imagepipeline.nativecode.WebpTranscoderImpl { *; } +-keep class com.facebook.imagepipeline.nativecode.WebpTranscoder { *; } + +-dontwarn com.facebook.imagepipeline.nativecode.** +-dontwarn com.facebook.imagepipeline.nativecode.WebpTranscoder + +# Do not strip any method/class that is annotated with @DoNotStrip +-keep @com.facebook.proguard.annotations.DoNotStrip class * +-keepclassmembers class * { + @com.facebook.proguard.annotations.DoNotStrip *; +} + +-keep @com.facebook.proguard.annotations.DoNotStripAny class * { + *; +} + +-keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * { + void set*(***); + *** get*(); +} + +-keep class * implements com.facebook.react.bridge.JavaScriptModule { *; } +-keep class * implements com.facebook.react.bridge.NativeModule { *; } +-keepclassmembers,includedescriptorclasses class * { native ; } +-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp ; } +-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup ; } + +-dontwarn com.facebook.react.** +-keep,includedescriptorclasses class com.facebook.react.bridge.** { *; } +-keep,includedescriptorclasses class com.facebook.react.turbomodule.core.** { *; } + +# hermes +-keep class com.facebook.jni.** { *; } + +# okio +-keep class sun.misc.Unsafe { *; } +-dontwarn java.nio.file.* +-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement +-dontwarn okio.** + +# yoga +-keep,allowobfuscation @interface com.facebook.yoga.annotations.DoNotStrip +-keep @com.facebook.yoga.annotations.DoNotStrip class * +-keepclassmembers class * { + @com.facebook.yoga.annotations.DoNotStrip *; +} + +# WebRTC + +-keep class org.webrtc.** { *; } +-dontwarn org.chromium.build.BuildHooksAndroid + +# Jisti Meet SDK + +-keep class org.jitsi.meet.** { *; } +-keep class org.jitsi.meet.sdk.** { *; } + +# We added the following when we switched minifyEnabled on. Probably because we +# ran the app and hit problems... + +-keep class com.facebook.react.bridge.CatalystInstanceImpl { *; } +-keep class com.facebook.react.bridge.ExecutorToken { *; } +-keep class com.facebook.react.bridge.JavaScriptExecutor { *; } +-keep class com.facebook.react.bridge.ModuleRegistryHolder { *; } +-keep class com.facebook.react.bridge.ReadableType { *; } +-keep class com.facebook.react.bridge.queue.NativeRunnable { *; } +-keep class com.facebook.react.devsupport.** { *; } + +-dontwarn com.facebook.react.devsupport.** +-dontwarn com.google.appengine.** +-dontwarn com.squareup.okhttp.** +-dontwarn javax.servlet.** + +# ^^^ We added the above when we switched minifyEnabled on. + +# Rule to avoid build errors related to SVGs. +-keep public class com.horcrux.svg.** {*;} + +# https://github.com/facebook/fresco/issues/2638 +-keep public class com.facebook.imageutils.** { + public *; +} diff --git a/assets/translations/en-US.json b/assets/translations/en-US.json index 4f26e45..b2f332d 100644 --- a/assets/translations/en-US.json +++ b/assets/translations/en-US.json @@ -964,6 +964,6 @@ "postVideoLiveDescription": "This is a live video, you can embed the source site by yourself.", "postVideoRendererWeb": "WebView Rendering", "postVideoRendererWebDescription": "Use WebView to render the content", - "fieldPostVideoStreamUrl": "Live Stream URL", - "fieldPostVideoStreamUrlDescription": "Live stream URL, can be HLS or webpage; use webpage renderer if you want to embed the webpage." + "fieldPostVideoUrl": "Video URL", + "fieldPostVideoUrlDescription": "The URL of the video content, it can be a webpage, and will be rendered by iFrame / WebView." } diff --git a/assets/translations/zh-CN.json b/assets/translations/zh-CN.json index 871625d..3593e0a 100644 --- a/assets/translations/zh-CN.json +++ b/assets/translations/zh-CN.json @@ -961,6 +961,6 @@ "postVideoLiveDescription": "这是一条直播影片,允许用户自行嵌入源站。", "postVideoRendererWeb": "网页渲染器", "postVideoRendererWebDescription": "使用 WebView 渲染内容。", - "fieldPostVideoStreamUrl": "直播流地址", - "fieldPostVideoStreamUrlDescription": "直播流地址,可以为 HLS,或者网页;使用网页嵌入请启用网页渲染器。" + "fieldPostVideoUrl": "视频流地址", + "fieldPostVideoUrlDescription": "视频内容的地址,可以为网页,将会使用 iFrame / WebView 渲染。" } diff --git a/lib/controllers/post_write_controller.dart b/lib/controllers/post_write_controller.dart index c20d12b..ea87e38 100644 --- a/lib/controllers/post_write_controller.dart +++ b/lib/controllers/post_write_controller.dart @@ -752,6 +752,7 @@ class PostWriteController extends ChangeNotifier { void setVideoUrl(String value) { videoUrl = value; + notifyListeners(); } void setVideoLive(bool value) { diff --git a/lib/screens/post/post_editor.dart b/lib/screens/post/post_editor.dart index 55b731b..51406ad 100644 --- a/lib/screens/post/post_editor.dart +++ b/lib/screens/post/post_editor.dart @@ -1219,19 +1219,21 @@ class _PostVideoEditorState extends State<_PostVideoEditor> { FocusManager.instance.primaryFocus?.unfocus(), ).padding(horizontal: 16), const Gap(12), - if (widget.controller.videoLive) + if (widget.controller.videoLive || + widget.controller.videoAttachment == null) TextField( controller: _streamUrlController, decoration: InputDecoration( - labelText: 'fieldPostVideoStreamUrl'.tr(), - helperText: 'fieldPostVideoStreamUrlDescription'.tr(), + labelText: 'fieldPostVideoUrl'.tr(), + helperText: 'fieldPostVideoUrlDescription'.tr(), border: OutlineInputBorder(), isDense: true, ), onTapOutside: (_) => FocusManager.instance.primaryFocus?.unfocus(), - ).padding(horizontal: 12) - else + ).padding(horizontal: 16, bottom: 12, top: 2), + if (!widget.controller.videoLive && + _streamUrlController.text.isEmpty) Container( margin: const EdgeInsets.only(left: 16, right: 16), decoration: BoxDecoration( diff --git a/lib/widgets/markdown_content.dart b/lib/widgets/markdown_content.dart index 1991be9..0eafb22 100644 --- a/lib/widgets/markdown_content.dart +++ b/lib/widgets/markdown_content.dart @@ -232,7 +232,7 @@ class _UserNameCardInlineSyntax extends markdown.InlineSyntax { final alias = match[0]!; final anchor = markdown.Element.text('a', alias) ..attributes['href'] = Uri.encodeFull( - 'solink://account/${alias.substring(1)}', + 'solink://accounts/${alias.substring(1)}', ); parser.addNode(anchor);