Skip to content

Commit

Permalink
Merge branch 'main' into build-ios
Browse files Browse the repository at this point in the history
  • Loading branch information
orz12 committed Oct 23, 2024
2 parents b632e81 + 4c10160 commit 431f31b
Show file tree
Hide file tree
Showing 106 changed files with 1,053 additions and 911 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ flutter --version
注:Framework revision XXXXXX可能会不一致,但后续时间应该是一致的
<br/>
Android相关版本:
> gradle: 7.6.3
> JDK: 21.0.4
> gradle: 8.10.2
> kotlin: 1.9.22
> minSdk: 21
> targetSdk: 34
Expand Down
13 changes: 8 additions & 5 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,24 @@ android {
compileSdkVersion 34

namespace 'com.orz12.PiliPalaX'
ndkVersion flutter.ndkVersion
// ndkVersion flutter.ndkVersion
ndkVersion = "27.0.12077973"

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_21
targetCompatibility JavaVersion.VERSION_21
encoding = "UTF-8"
}

kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '21'
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.orz12.PiliPalaX"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
Expand Down Expand Up @@ -95,6 +96,8 @@ flutter {
}

dependencies {
implementation 'androidx.annotation:annotation:1.9.0'
implementation 'org.conscrypt:conscrypt-android:2.5.2'
}

ext.abiCodes = ["x86_64": 1, "armeabi-v7a": 2, "arm64-v8a": 3]
Expand Down
3 changes: 3 additions & 0 deletions android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-dontwarn com.android.org.conscrypt.SSLParametersImpl
-dontwarn javax.annotation.Nullable
-dontwarn org.apache.harmony.xnet.provider.jsse.SSLParametersImpl
28 changes: 18 additions & 10 deletions android/app/src/main/kotlin/com/orz12/PiliPalaX/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,34 @@ package com.orz12.PiliPalaX
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
//import io.flutter.plugin.common.MethodChannel
import com.ryanheise.audioservice.AudioServiceActivity
//import com.ryanheise.audioservice.AudioServiceActivity
import com.ryanheise.audioservice.AudioServicePlugin
import android.os.Build
import android.os.Bundle
import android.view.WindowManager.LayoutParams
//import android.view.WindowManager.LayoutParams
import fl.pip.FlPiPActivity
import android.content.Context
import androidx.annotation.NonNull

class MainActivity : AudioServiceActivity() {
//class AudioServiceActivity : FlPiPActivity() {
class MainActivity : FlPiPActivity() {
// private lateinit var methodChannel: MethodChannel

override fun provideFlutterEngine(context: Context): FlutterEngine {
return AudioServicePlugin.getFlutterEngine(context)
}
// override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
// super.configureFlutterEngine(flutterEngine)
// methodChannel = MethodChannel(flutterEngine!!.getDartExecutor()!!.getBinaryMessenger(), CHANNEL)
// }

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
window.attributes.layoutInDisplayCutoutMode =
LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
}
}
// override fun onCreate(savedInstanceState: Bundle?) {
// super.onCreate(savedInstanceState)
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
// window.attributes.layoutInDisplayCutoutMode =
// LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
// }
// }

// override fun onUserLeaveHint() {
// super.onUserLeaveHint()
Expand Down
16 changes: 16 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@ subprojects {
}
}
}
if (project.hasProperty('android')) {
project.android {
if (namespace == null) {
project.logger.error(
"Warning: 'namespace' is not specified in Flutter plugin: "
+ project.name
+ ". Defaulting to the package name "
+ project.group
+ " of the plugin.\nSee "
+ "https://d.android.com/r/tools/upgrade-assistant/set-namespace"
+ "for information about setting the namespace."
)
namespace project.group
}
}
}
}
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
Expand Down
3 changes: 2 additions & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Mon Oct 14 04:55:29 CST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
5 changes: 3 additions & 2 deletions android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ pluginManagement {

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.2.0" apply false
id "org.jetbrains.kotlin.android" version "1.9.22" apply false
id "com.android.application" version "8.7.0" apply false
// id "com.android.library" version "8.7.0" apply false
id "org.jetbrains.kotlin.android" version "2.0.20" apply false
}

include ":app"
9 changes: 7 additions & 2 deletions ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import fl_pip
import UIKit
import Flutter

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
@main
@objc class AppDelegate: FlFlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}

override func registerPlugin(_ registry: FlutterPluginRegistry) {
GeneratedPluginRegistrant.register(with: registry)
}
}
21 changes: 11 additions & 10 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,20 @@
</dict>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSBonjourServices</key>
<array>
<string>_dartobservatory._tcp</string>
</array>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSBonjourServices</key>
<array>
<string>_dartVmService._tcp</string>
</array>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
<string>processing</string>
<string>remote-notification</string>
<string>fetch</string>
<string>processing</string>
<string>remote-notification</string>
</array>
<key>UIStatusBarHidden</key>
<false/>
Expand Down
4 changes: 2 additions & 2 deletions lib/common/skeleton/skeleton.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class Skeleton extends StatelessWidget {
var shimmerGradient = LinearGradient(
colors: [
Colors.transparent,
Theme.of(context).colorScheme.background.withAlpha(10),
Theme.of(context).colorScheme.background.withAlpha(10),
Theme.of(context).colorScheme.surface.withAlpha(10),
Theme.of(context).colorScheme.surface.withAlpha(10),
Colors.transparent,
],
stops: const [
Expand Down
2 changes: 1 addition & 1 deletion lib/common/skeleton/video_card_v.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
import 'skeleton.dart';

class VideoCardVSkeleton extends StatelessWidget {
const VideoCardVSkeleton({Key? key}) : super(key: key);
const VideoCardVSkeleton({super.key});

@override
Widget build(BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion lib/common/skeleton/video_reply.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'skeleton.dart';

class VideoReplySkeleton extends StatelessWidget {
const VideoReplySkeleton({Key? key}) : super(key: key);
const VideoReplySkeleton({super.key});

@override
Widget build(BuildContext context) {
Expand Down
3 changes: 1 addition & 2 deletions lib/common/widgets/animated_dialog.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import 'package:flutter/material.dart';

class AnimatedDialog extends StatefulWidget {
const AnimatedDialog({Key? key, required this.child, this.closeFn})
: super(key: key);
const AnimatedDialog({super.key, required this.child, this.closeFn});

final Widget child;
final Function? closeFn;
Expand Down
4 changes: 2 additions & 2 deletions lib/common/widgets/appbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ class AppBarWidget extends StatelessWidget implements PreferredSizeWidget {
required this.child,
required this.controller,
required this.visible,
Key? key,
}) : super(key: key);
super.key,
});

final PreferredSizeWidget child;
final AnimationController controller;
Expand Down
18 changes: 9 additions & 9 deletions lib/common/widgets/audio_video_progress_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class ProgressBar extends LeafRenderObjectWidget {
/// When a user drags the thumb to a new location you can be notified
/// by the [onSeek] callback so that you can update your audio/video player.
const ProgressBar({
Key? key,
super.key,
required this.progress,
required this.total,
this.buffered,
Expand All @@ -96,7 +96,7 @@ class ProgressBar extends LeafRenderObjectWidget {
this.timeLabelType,
this.timeLabelTextStyle,
this.timeLabelPadding = 0.0,
}) : super(key: key);
});

/// The elapsed playing time of the media.
///
Expand Down Expand Up @@ -274,7 +274,7 @@ class ProgressBar extends LeafRenderObjectWidget {
thumbRadius: thumbRadius,
thumbColor: thumbColor ?? primaryColor,
thumbGlowColor:
thumbGlowColor ?? (thumbColor ?? primaryColor).withAlpha(80),
thumbGlowColor ?? (thumbColor ?? primaryColor).withAlpha(80),
thumbGlowRadius: thumbGlowRadius,
thumbCanPaintOutsideBar: thumbCanPaintOutsideBar,
timeLabelLocation: timeLabelLocation ?? TimeLabelLocation.below,
Expand Down Expand Up @@ -958,7 +958,7 @@ class _RenderProgressBar extends RenderBox {

// progress bar
final barDy =
(isLabelBelow) ? 0.0 : _leftLabelSize.height + _timeLabelPadding;
(isLabelBelow) ? 0.0 : _leftLabelSize.height + _timeLabelPadding;
_drawProgressBar(canvas, Offset(0, barDy), Size(barWidth, barHeight));
}

Expand Down Expand Up @@ -1042,9 +1042,9 @@ class _RenderProgressBar extends RenderBox {

void _drawBar(
{required Canvas canvas,
required Size availableSize,
required double widthProportion,
required Color color}) {
required Size availableSize,
required double widthProportion,
required Color color}) {
final strokeCap = (_barCapShape == BarCapShape.round)
? StrokeCap.round
: StrokeCap.square;
Expand Down Expand Up @@ -1085,7 +1085,7 @@ class _RenderProgressBar extends RenderBox {

String _getTimeString(Duration time) {
final minutes =
time.inMinutes.remainder(Duration.minutesPerHour).toString();
time.inMinutes.remainder(Duration.minutesPerHour).toString();
final seconds = time.inSeconds
.remainder(Duration.secondsPerMinute)
.toString()
Expand All @@ -1101,7 +1101,7 @@ class _RenderProgressBar extends RenderBox {

// description
config.textDirection = TextDirection.ltr;
config.label = '进度条';//'Progress bar';
config.label = '进度条'; //'Progress bar';
config.value = '${(_thumbValue * 100).round()}%';

// increase action
Expand Down
5 changes: 2 additions & 3 deletions lib/common/widgets/content_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ class ContentContainer extends StatelessWidget {
final Clip? childClipBehavior;

const ContentContainer(
{Key? key,
{super.key,
this.contentWidget,
this.bottomWidget,
this.isScrollable = true,
this.childClipBehavior})
: super(key: key);
this.childClipBehavior});

@override
Widget build(BuildContext context) {
Expand Down
3 changes: 0 additions & 3 deletions lib/common/widgets/html_render.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import 'dart:ffi';

import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:get/get.dart';
import '../../utils/storage.dart';
import 'network_img_layer.dart';

Expand Down
2 changes: 1 addition & 1 deletion lib/common/widgets/http_error.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class HttpError extends StatelessWidget {
fn!();
},
style: ButtonStyle(
backgroundColor: MaterialStateProperty.resolveWith((states) {
backgroundColor: WidgetStateProperty.resolveWith((states) {
return Theme.of(context).colorScheme.primary.withAlpha(20);
}),
),
Expand Down
6 changes: 3 additions & 3 deletions lib/common/widgets/live_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ class LiveCard extends StatelessWidget {
final dynamic liveItem;

const LiveCard({
Key? key,
super.key,
required this.liveItem,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -77,7 +77,7 @@ class LiveCard extends StatelessWidget {
class LiveContent extends StatelessWidget {
// ignore: prefer_typing_uninitialized_variables
final liveItem;
const LiveContent({Key? key, required this.liveItem}) : super(key: key);
const LiveContent({super.key, required this.liveItem});
@override
Widget build(BuildContext context) {
return Padding(
Expand Down
1 change: 0 additions & 1 deletion lib/common/widgets/network_img_layer.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:hive/hive.dart';
import 'package:PiliPalaX/utils/extension.dart';
import 'package:PiliPalaX/utils/global_data.dart';
Expand Down
6 changes: 3 additions & 3 deletions lib/common/widgets/overlay_pop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ class OverlayPop extends StatelessWidget {

@override
Widget build(BuildContext context) {
final double imgWidth = min(Get.height,Get.width) - 8 * 2;
final double imgWidth = min(Get.height, Get.width) - 8 * 2;
return Container(
margin: const EdgeInsets.symmetric(horizontal: 8),
width: imgWidth,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.background,
color: Theme.of(context).colorScheme.surface,
borderRadius: BorderRadius.circular(10.0),
),
child: Column(
Expand Down Expand Up @@ -47,7 +47,7 @@ class OverlayPop extends StatelessWidget {
child: IconButton(
tooltip: '关闭',
style: ButtonStyle(
padding: MaterialStateProperty.all(EdgeInsets.zero),
padding: WidgetStateProperty.all(EdgeInsets.zero),
),
onPressed: () => closeFn!(),
icon: const Icon(
Expand Down
Loading

0 comments on commit 431f31b

Please sign in to comment.