Skip to content

Commit

Permalink
Add Swift Package Manager support. Closes #749. Update example to use…
Browse files Browse the repository at this point in the history
… Kotlin.
  • Loading branch information
jonbhanson committed Nov 17, 2024
1 parent b4aff7b commit 62ee636
Show file tree
Hide file tree
Showing 24 changed files with 76 additions and 62 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
2 changes: 1 addition & 1 deletion example/android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
28 changes: 7 additions & 21 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package net.jonhanson.flutter_native_splash_example

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity()
2 changes: 1 addition & 1 deletion example/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions example/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion example/ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Flutter
import UIKit

@UIApplicationMain
@main
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
Expand Down
20 changes: 10 additions & 10 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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"
8 changes: 4 additions & 4 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion example/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<meta charset="UTF-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
<meta name="description" content="A new Flutter project.">
<meta name="description" content="Example for Flutter Native Splash package">

<!-- iOS meta tags & icons -->
<meta name="apple-mobile-web-app-capable" content="yes">
Expand Down
2 changes: 1 addition & 1 deletion example/web/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
Empty file removed ios/Assets/.gitkeep
Empty file.
16 changes: 8 additions & 8 deletions ios/flutter_native_splash.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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 protected]' }
s.author = { 'Jon Hanson' => '[email protected]' }
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' }
Expand Down
24 changes: 24 additions & 0 deletions ios/flutter_native_splash/Package.swift
Original file line number Diff line number Diff line change
@@ -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"),
]
)
]
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/cli_commands.dart
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
2 changes: 1 addition & 1 deletion lib/flutter_native_splash.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion lib/remove_splash_from_web.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@JS()
library remove_splash_from_web;
library;

import 'dart:js_interop';

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 62ee636

Please sign in to comment.