diff --git a/CHANGELOG.md b/CHANGELOG.md index b91229a..bb85e0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## [2.4.3] - (2024-Nov-17) + +- Add Swift Package Manager support. Closes [#749](https://github.com/jonbhanson/flutter_native_splash/issues/749). +- Update example to use Kotlin. + ## [2.4.2] - (2024-Oct-20) - Updated dependencies. diff --git a/README.md b/README.md index 98080ae..bfdc8f5 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ First, add `flutter_native_splash` as a dependency in your pubspec.yaml file. ```yaml dependencies: - flutter_native_splash: ^2.4.2 + flutter_native_splash: ^2.4.3 ``` Don't forget to `flutter pub get`. diff --git a/example/android/.gitignore b/example/android/.gitignore index 6f56801..55afd91 100644 --- a/example/android/.gitignore +++ b/example/android/.gitignore @@ -7,7 +7,7 @@ gradle-wrapper.jar GeneratedPluginRegistrant.java # Remember to never publicly share your keystore. -# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +# See https://flutter.dev/to/reference-keystore key.properties **/*.keystore **/*.jks diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index cb89eef..9d0469f 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -5,24 +5,6 @@ plugins { id "dev.flutter.flutter-gradle-plugin" } -def localProperties = new Properties() -def localPropertiesFile = rootProject.file("local.properties") -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader("UTF-8") { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty("flutter.versionCode") -if (flutterVersionCode == null) { - flutterVersionCode = "1" -} - -def flutterVersionName = localProperties.getProperty("flutter.versionName") -if (flutterVersionName == null) { - flutterVersionName = "1.0" -} - android { namespace = "net.jonhanson.flutter_native_splash_example" compileSdk = flutter.compileSdkVersion @@ -33,15 +15,19 @@ android { targetCompatibility = JavaVersion.VERSION_1_8 } + kotlinOptions { + jvmTarget = JavaVersion.VERSION_1_8 + } + defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId = "net.jonhanson.flutter_native_splash_example" // 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. + // For more information, see: https://flutter.dev/to/review-gradle-config. minSdk = flutter.minSdkVersion targetSdk = flutter.targetSdkVersion - versionCode = flutterVersionCode.toInteger() - versionName = flutterVersionName + versionCode = flutter.versionCode + versionName = flutter.versionName } buildTypes { diff --git a/example/android/app/src/main/java/net/jonhanson/flutter_native_splash_example/MainActivity.java b/example/android/app/src/main/java/net/jonhanson/flutter_native_splash_example/MainActivity.java deleted file mode 100644 index f5f9b0c..0000000 --- a/example/android/app/src/main/java/net/jonhanson/flutter_native_splash_example/MainActivity.java +++ /dev/null @@ -1,6 +0,0 @@ -package net.jonhanson.flutter_native_splash_example; - -import io.flutter.embedding.android.FlutterActivity; - -public class MainActivity extends FlutterActivity { -} diff --git a/example/android/app/src/main/kotlin/net/jonhanson/flutter_native_splash_example/MainActivity.kt b/example/android/app/src/main/kotlin/net/jonhanson/flutter_native_splash_example/MainActivity.kt new file mode 100644 index 0000000..ab13bac --- /dev/null +++ b/example/android/app/src/main/kotlin/net/jonhanson/flutter_native_splash_example/MainActivity.kt @@ -0,0 +1,5 @@ +package net.jonhanson.flutter_native_splash_example + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() diff --git a/example/android/gradle.properties b/example/android/gradle.properties index 3b5b324..2597170 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -1,3 +1,3 @@ -org.gradle.jvmargs=-Xmx4G -XX:+HeapDumpOnOutOfMemoryError +org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError android.useAndroidX=true android.enableJetifier=true diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index e1ca574..7bb2df6 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip diff --git a/example/android/settings.gradle b/example/android/settings.gradle index 536165d..b9e43bd 100644 --- a/example/android/settings.gradle +++ b/example/android/settings.gradle @@ -18,8 +18,8 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "7.3.0" apply false - id "org.jetbrains.kotlin.android" version "1.7.10" apply false + id "com.android.application" version "8.1.0" apply false + id "org.jetbrains.kotlin.android" version "1.8.22" apply false } include ":app" diff --git a/example/ios/Runner/AppDelegate.swift b/example/ios/Runner/AppDelegate.swift index 9074fee..6266644 100644 --- a/example/ios/Runner/AppDelegate.swift +++ b/example/ios/Runner/AppDelegate.swift @@ -1,7 +1,7 @@ import Flutter import UIKit -@UIApplicationMain +@main @objc class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, diff --git a/example/pubspec.lock b/example/pubspec.lock index 61c8db6..7ce441a 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -69,18 +69,18 @@ packages: dependency: transitive description: name: crypto - sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" url: "https://pub.dev" source: hosted - version: "3.0.3" + version: "3.0.6" csslib: dependency: transitive description: name: csslib - sha256: "706b5707578e0c1b4b7550f64078f0a0f19dec3f50a178ffae7006b0a9ca58fb" + sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e" url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "1.0.2" cupertino_icons: dependency: "direct main" description: @@ -116,7 +116,7 @@ packages: path: ".." relative: true source: path - version: "2.4.2" + version: "2.4.3" flutter_test: dependency: "direct dev" description: flutter @@ -131,10 +131,10 @@ packages: dependency: transitive description: name: html - sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a" + sha256: "1fc58edeaec4307368c60d59b7e15b9d658b57d7f3125098b6294153c75337ec" url: "https://pub.dev" source: hosted - version: "0.15.4" + version: "0.15.5" image: dependency: transitive description: @@ -272,10 +272,10 @@ packages: dependency: transitive description: name: typed_data - sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 url: "https://pub.dev" source: hosted - version: "1.3.2" + version: "1.4.0" universal_io: dependency: transitive description: @@ -317,5 +317,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.5.0 <4.0.0" + dart: ">=3.5.4 <4.0.0" flutter: ">=3.18.0-18.0.pre.54" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 8cf724a..1cc7928 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -19,7 +19,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: '>=3.4.3 <4.0.0' + sdk: ^3.5.4 # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions @@ -66,10 +66,10 @@ flutter: # - images/a_dot_ham.jpeg # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware + # https://flutter.dev/to/resolution-aware-images # For details regarding adding assets from package dependencies, see - # https://flutter.dev/assets-and-images/#from-packages + # https://flutter.dev/to/asset-from-package # To add custom fonts to your application, add a fonts section here, # in this "flutter" section. Each entry in this list should have a @@ -89,7 +89,7 @@ flutter: # weight: 700 # # For details regarding fonts from package dependencies, - # see https://flutter.dev/custom-fonts/#from-packages + # see https://flutter.dev/to/font-from-package flutter_native_splash: diff --git a/example/web/index.html b/example/web/index.html index 9dfa8f1..1a94e95 100644 --- a/example/web/index.html +++ b/example/web/index.html @@ -18,7 +18,7 @@ - + diff --git a/example/web/manifest.json b/example/web/manifest.json index dbcd93c..150ea37 100644 --- a/example/web/manifest.json +++ b/example/web/manifest.json @@ -5,7 +5,7 @@ "display": "standalone", "background_color": "#0175C2", "theme_color": "#0175C2", - "description": "A new Flutter project.", + "description": "Example for Flutter Native Splash package", "orientation": "portrait-primary", "prefer_related_applications": false, "icons": [ diff --git a/ios/Assets/.gitkeep b/ios/Assets/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/ios/flutter_native_splash.podspec b/ios/flutter_native_splash.podspec index 1274eed..4c44f64 100644 --- a/ios/flutter_native_splash.podspec +++ b/ios/flutter_native_splash.podspec @@ -4,20 +4,20 @@ # Pod::Spec.new do |s| s.name = 'flutter_native_splash' - s.version = '0.0.1' - s.summary = 'A new Flutter project.' + s.version = '2.4.3' + s.summary = 'Flutter Native Splash' s.description = <<-DESC -A new Flutter project. +Customize Flutter's default white native splash screen with background color and splash image. Supports dark mode, full screen, and more. DESC - s.homepage = 'http://example.com' + s.homepage = 'https://github.com/jonbhanson/flutter_native_splash' s.license = { :file => '../LICENSE' } - s.author = { 'Your Company' => 'email@example.com' } + s.author = { 'Jon Hanson' => 'jon@jonhanson.net' } s.source = { :path => '.' } - s.source_files = 'Classes/**/*' - s.public_header_files = 'Classes/**/*.h' + s.source_files = 'flutter_native_splash/Sources/flutter_native_splash/**/*' + s.public_header_files = 'flutter_native_splash/Sources/flutter_native_splash/**/*.h' s.dependency 'Flutter' s.platform = :ios, '9.0' - s.resource_bundles = {'flutter_native_splash_privacy' => ['Resources/PrivacyInfo.xcprivacy']} + s.resource_bundles = {'flutter_native_splash_privacy' => ['flutter_native_splash/Sources/flutter_native_splash/PrivacyInfo.xcprivacy']} # Flutter.framework does not contain a i386 slice. s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } diff --git a/ios/flutter_native_splash/Package.swift b/ios/flutter_native_splash/Package.swift new file mode 100644 index 0000000..3c69711 --- /dev/null +++ b/ios/flutter_native_splash/Package.swift @@ -0,0 +1,24 @@ +// swift-tools-version: 5.9 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "flutter_native_splash", + platforms: [ + .iOS("12.0"), + ], + products: [ + .library(name: "flutter-native-splash", targets: ["flutter_native_splash"]) + ], + dependencies: [], + targets: [ + .target( + name: "flutter_native_splash", + dependencies: [], + resources: [ + .process("PrivacyInfo.xcprivacy"), + ] + ) + ] +) \ No newline at end of file diff --git a/ios/Classes/FlutterNativeSplashPlugin.h b/ios/flutter_native_splash/Sources/flutter_native_splash/FlutterNativeSplashPlugin.h similarity index 100% rename from ios/Classes/FlutterNativeSplashPlugin.h rename to ios/flutter_native_splash/Sources/flutter_native_splash/FlutterNativeSplashPlugin.h diff --git a/ios/Classes/FlutterNativeSplashPlugin.m b/ios/flutter_native_splash/Sources/flutter_native_splash/FlutterNativeSplashPlugin.m similarity index 100% rename from ios/Classes/FlutterNativeSplashPlugin.m rename to ios/flutter_native_splash/Sources/flutter_native_splash/FlutterNativeSplashPlugin.m diff --git a/ios/Resources/PrivacyInfo.xcprivacy b/ios/flutter_native_splash/Sources/flutter_native_splash/PrivacyInfo.xcprivacy similarity index 100% rename from ios/Resources/PrivacyInfo.xcprivacy rename to ios/flutter_native_splash/Sources/flutter_native_splash/PrivacyInfo.xcprivacy diff --git a/lib/cli_commands.dart b/lib/cli_commands.dart index 49fcc6f..c5fdbb6 100644 --- a/lib/cli_commands.dart +++ b/lib/cli_commands.dart @@ -1,7 +1,7 @@ /// ## Flutter Native Splash /// /// This is the main entry point for the Flutter Native Splash package. -library flutter_native_splash_cli; +library; import 'dart:isolate'; diff --git a/lib/flutter_native_splash.dart b/lib/flutter_native_splash.dart index a3f3bc9..5a742d4 100644 --- a/lib/flutter_native_splash.dart +++ b/lib/flutter_native_splash.dart @@ -4,7 +4,7 @@ /// Web-native code for customizing this native splash screen background color /// and splash image. Supports dark mode, full screen, and platform-specific /// options. -library flutter_native_splash; +library; import 'package:flutter/foundation.dart'; import 'package:flutter/scheduler.dart'; diff --git a/lib/remove_splash_from_web.dart b/lib/remove_splash_from_web.dart index 968e7e4..bb2676d 100644 --- a/lib/remove_splash_from_web.dart +++ b/lib/remove_splash_from_web.dart @@ -1,5 +1,5 @@ @JS() -library remove_splash_from_web; +library; import 'dart:js_interop'; diff --git a/pubspec.yaml b/pubspec.yaml index 17b1a73..145c580 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: flutter_native_splash description: Customize Flutter's default white native splash screen with background color and splash image. Supports dark mode, full screen, and more. -version: 2.4.2 +version: 2.4.3 repository: https://github.com/jonbhanson/flutter_native_splash issue_tracker: https://github.com/jonbhanson/flutter_native_splash/issues