Skip to content

[flutter_splash_tizen] Initial implementation #266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
0a3c42e
flutter tizen splash
JRazek Nov 5, 2021
0f4ad8a
img change
JRazek Nov 5, 2021
abc30f7
license, changelog
JRazek Nov 5, 2021
065e874
cleanup
JRazek Nov 5, 2021
1672142
minimal main, new line at the end of the file
JRazek Nov 5, 2021
5520b56
more cleanup
JRazek Nov 5, 2021
1ac69b2
example path fix
JRazek Nov 5, 2021
4620b31
main fixes
JRazek Nov 8, 2021
0ee9340
flag fixes
JRazek Nov 8, 2021
2f6303c
flag fixes
JRazek Nov 8, 2021
5917fce
flag fixes
JRazek Nov 8, 2021
0f73916
flag fixes
JRazek Nov 8, 2021
07f43b3
flag fixes
JRazek Nov 8, 2021
b3a41f7
suggested fixes and cleanups
JRazek Nov 9, 2021
0aa13d9
version
JRazek Nov 9, 2021
02e6a45
homepage, repository
JRazek Nov 9, 2021
898757b
tv info removal
JRazek Nov 9, 2021
0b43e66
tizen-manifest cleanup
JRazek Nov 9, 2021
0cd16b6
cleanup...
JRazek Nov 9, 2021
220a58d
remove bug fix
JRazek Nov 9, 2021
6301cb7
intergration test exclude
JRazek Nov 9, 2021
2ce30eb
intergration test exclude
JRazek Nov 9, 2021
e047ba7
integration, LICENSE
JRazek Nov 9, 2021
5eacc8a
new lines files
JRazek Nov 9, 2021
3944f4a
pretty XML
JRazek Nov 9, 2021
1c44a2a
example should be out of box working
JRazek Nov 9, 2021
6c75101
file_utils.dart not needed anymore. Removed redundant file read.
JRazek Nov 9, 2021
f41ffb1
remove not added fix
JRazek Nov 9, 2021
bbd104d
integration tests comments
JRazek Nov 10, 2021
e64f750
readme supported platforms
JRazek Nov 10, 2021
b3e8736
dart format
JRazek Nov 15, 2021
7794d00
analyze
JRazek Nov 15, 2021
ce20502
curly brackets and key widget constructor
JRazek Nov 16, 2021
3f1f7bb
formating, consts
JRazek Nov 17, 2021
73a9641
formating, consts
JRazek Nov 17, 2021
718934e
readme, labeler
JRazek Nov 17, 2021
9a3a0d3
not a package, formatting in pubspec
JRazek Nov 26, 2021
7973e7b
published
JRazek Nov 26, 2021
18278a6
readme wasnt added in the first push
JRazek Nov 26, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
- packages/device_info/**/*
'p: device_info_plus':
- packages/device_info_plus/**/*
'p: flutter_splash_tizen':
- packages/flutter_splash_tizen/**/*
'p: flutter_tts':
- packages/flutter_tts/**/*
'p: geolocator':
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ jobs:
--exclude wearable_rotary image_picker camera webview_flutter \
video_player permission_handler geolocator battery connectivity \
device_info package_info sensors share wifi_info_flutter \
google_maps_flutter tizen_app_control url_launcher network_info_plus
google_maps_flutter tizen_app_control url_launcher network_info_plus \
flutter_splash_tizen
- name: Run tests for all plugins
if: ${{ github.event_name == 'push' }}
run: |
Expand All @@ -43,9 +44,10 @@ jobs:
--exclude wearable_rotary image_picker camera webview_flutter \
video_player permission_handler geolocator battery connectivity \
device_info package_info sensors share wifi_info_flutter \
google_maps_flutter tizen_app_control url_launcher network_info_plus
google_maps_flutter tizen_app_control url_launcher network_info_plus \
flutter_splash_tizen
# The following packages are excluded from tests:
# wearable_rotary, image_picker: no tests.
# wearable_rotary, image_picker, flutter_splash_tizen: no tests.
# camera: no supported profiles.
# video_player: test frequently breaks due to memory issue(https://github.com/flutter-tizen/plugins/issues/135).
# permission_handler: permission related test.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ The _"non-endorsed"_ status means that the plugin is not endorsed by the origina
| [**camera_tizen**](packages/camera) | [camera](https://github.com/flutter/plugins/tree/master/packages/camera) (1st-party) | [![pub package](https://img.shields.io/pub/v/camera_tizen.svg)](https://pub.dev/packages/camera_tizen) | No |
| [**connectivity_plus_tizen**](packages/connectivity_plus) | [connectivity_plus](https://github.com/fluttercommunity/plus_plugins/tree/main/packages/connectivity_plus) (1st-party) | [![pub package](https://img.shields.io/pub/v/connectivity_plus_tizen.svg)](https://pub.dev/packages/connectivity_plus_tizen) | No |
| [**device_info_plus_tizen**](packages/device_info_plus) | [device_info_plus](https://github.com/fluttercommunity/plus_plugins/tree/main/packages/device_info_plus) (1st-party) | [![pub package](https://img.shields.io/pub/v/device_info_plus_tizen.svg)](https://pub.dev/packages/device_info_plus_tizen) | No |
| [**flutter_splash_tizen**](packages/flutter_splash_tizen) | (Tizen-only) | [![pub package](https://img.shields.io/pub/v/flutter_splash_tizen.svg)](https://pub.dev/packages/flutter_splash_tizen) | N/A |
| [**flutter_tts_tizen**](packages/flutter_tts) | [flutter_tts](https://github.com/dlutton/flutter_tts) (3rd-party) | [![pub package](https://img.shields.io/pub/v/flutter_tts_tizen.svg)](https://pub.dev/packages/flutter_tts_tizen) | No |
| [**geolocator_tizen**](packages/geolocator) | [geolocator](https://github.com/Baseflow/flutter-geolocator/tree/master/geolocator) (3rd-party) | [![pub package](https://img.shields.io/pub/v/geolocator_tizen.svg)](https://pub.dev/packages/geolocator_tizen) | No |
| [**google_maps_flutter_tizen**](packages/google_maps_flutter) | [google_maps_flutter](https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter) (1st-party) | [![pub package](https://img.shields.io/pub/v/google_maps_flutter_tizen.svg)](https://pub.dev/packages/google_maps_flutter_tizen) | No |
Expand Down
8 changes: 8 additions & 0 deletions packages/flutter_splash_tizen/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store
.dart_tool/

.packages
.pub/
.vscode/
.idea/
build/
2 changes: 2 additions & 0 deletions packages/flutter_splash_tizen/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## 0.1.0
* Initial release
25 changes: 25 additions & 0 deletions packages/flutter_splash_tizen/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Copyright (c) 2021 Samsung Electronics Co., Ltd. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of the copyright holder nor the names of the
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 changes: 33 additions & 0 deletions packages/flutter_splash_tizen/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# flutter_splash_tizen

Flutter-tizen package that allows to add custom splash-screen images into your apps.
## Getting Started

First you should add the package to dev_dependencies section in your `pubspec.yaml`

```yaml
dev_dependencies:
flutter_splash_tizen: ^0.1.0
```
After that run
```
flutter-tizen pub get
```
in order to download the dependency.

By adding
```yaml
flutter_splash_tizen:
image: test.png
```
section in your `pubspec.yaml` and running
```
flutter-tizen pub run flutter_splash_tizen:create
```
the image from `tizen/shared/res/test.png` will be added as splash screen. Each call of `create` will override the previous. <br>

If you wish to remove the splash image from your app simply run
```
flutter-tizen pub run flutter_splash_tizen:remove
```
Package has been tested on Mobile 6.0, Wearable 6.0 and IoT Headed 6.5 platform.
1 change: 1 addition & 0 deletions packages/flutter_splash_tizen/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include: package:flutter_lints/flutter.yaml
57 changes: 57 additions & 0 deletions packages/flutter_splash_tizen/bin/create.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import 'dart:io';
import 'package:yaml/yaml.dart';
import 'package:xml/xml.dart';

Map? loadYamlFileSync(String path) {
File file = File(path);
if (file.existsSync()) {
return loadYaml(file.readAsStringSync());
}
return null;
}

XmlDocument? loadXMLFileSync(String path) {
File file = File(path);
if (file.existsSync()) {
return XmlDocument.parse(file.readAsStringSync());
}
return null;
}

void main() {
var doc = loadYamlFileSync("pubspec.yaml")?['flutter_splash_tizen'];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if I understand correctly, current flow supports only adding a file once, then file added to yaml will be copied to tizen-manifest. What about changing a file mentioned in yaml during the development? Shouldn't we consider a scenario that a file is added to manifest file everytime when application is built which means that the file used in tizen manifest will be kept in sync with file mentioned in pubspec.yaml file?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@swift-kim could you please share your opinion regarding this comment? Should we set splash screen 'on demand' only, or rather do it automatically on every build?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to sync automatically every build if possible. By the way, is there a way to run this package every build?
Should we add this feature to flutter-tizen tool?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc can be null. please check it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pkosko You can just follow flutter_native_splash's way. So manually running the pub run command every time the attributes are changed should just be enough.

if (doc == null) throw const FormatException("could not read pubspec.yaml!");

String? image = doc["image"];
if (image == null) {
throw const FormatException("could not find image section!");
}
const String tizenManifestPath = "tizen/tizen-manifest.xml";

XmlDocument? tizenManifest = loadXMLFileSync(tizenManifestPath);
if (tizenManifest == null) {
throw const FormatException("could not read tizen-manifext.xml!");
}
XmlNode el = tizenManifest.root;

XmlElement? uiApp = el.getElement("manifest")?.getElement("ui-application");
if (uiApp == null) {
throw const FormatException("error when reading $tizenManifestPath");
}
XmlElement? splashScreens = uiApp.getElement("splash-screens");
if (splashScreens == null) {
splashScreens = XmlElement(XmlName("splash-screens"));
uiApp.children.add(splashScreens);
}

splashScreens.children.clear();
XmlElement splashScreen = XmlElement(XmlName("splash-screen"));
splashScreen.setAttribute("src", image);
splashScreen.setAttribute("type", "img");
splashScreen.setAttribute("indicator-display", "false");
splashScreen.setAttribute("orientation", "portrait");
splashScreens.children.add(splashScreen);

File(tizenManifestPath)
.writeAsStringSync(el.toXmlString(pretty: true, indent: ' ') + '\n');
}
25 changes: 25 additions & 0 deletions packages/flutter_splash_tizen/bin/remove.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import 'dart:io';
import 'package:xml/xml.dart';

void main() {
const String tizenManifestPath = "tizen/tizen-manifest.xml";
File tizenManifestFile = File(tizenManifestPath);
if (!tizenManifestFile.existsSync()) {
throw const FormatException("could not read tizen-manifext.xml!");
}
XmlDocument? tizenManifest =
XmlDocument.parse(tizenManifestFile.readAsStringSync());
XmlNode el = tizenManifest.root;

XmlElement? uiApp = el.getElement("manifest")?.getElement("ui-application");
if (uiApp == null) {
throw const FormatException("error when reading $tizenManifestPath");
}
XmlElement? splashScreens = uiApp.getElement("splash-screens");

if (splashScreens != null) {
splashScreens.children.clear();
File(tizenManifestPath)
.writeAsStringSync(el.toXmlString(pretty: true, indent: ' ') + '\n');
}
}
44 changes: 44 additions & 0 deletions packages/flutter_splash_tizen/example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# VS Code related
.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/

# Web related
lib/generated_plugin_registrant.dart

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
3 changes: 3 additions & 0 deletions packages/flutter_splash_tizen/example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# flutter_splash_tizen_example

Demonstrates how to use the flutter_splash_tizen package.
4 changes: 4 additions & 0 deletions packages/flutter_splash_tizen/example/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include: package:flutter_lints/flutter.yaml

linter:
rules:
21 changes: 21 additions & 0 deletions packages/flutter_splash_tizen/example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Welcome to Flutter',
home: Scaffold(
appBar: AppBar(
title: const Text('Welcome to Flutter'),
),
body: const Center(
child: Text('sample app for flutter splash tizen'),
),
),
);
}
}
23 changes: 23 additions & 0 deletions packages/flutter_splash_tizen/example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: flutter_splash_tizen_example
description: Demonstrates how to use the flutter_splash_tizen package.

publish_to: 'none'

environment:
sdk: ">=2.12.0 <3.0.0"

dependencies:
cupertino_icons: ^1.0.2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sort the dependencies alphabetically and remove extra newlines between the dependencies.


dev_dependencies:
flutter:
sdk: flutter
flutter_lints: ^1.0.0
flutter_splash_tizen:
path: ../

flutter:
uses-material-design: true

flutter_splash_tizen:
image: test.png
5 changes: 5 additions & 0 deletions packages/flutter_splash_tizen/example/tizen/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
flutter/
.vs/
*.user
bin/
obj/
20 changes: 20 additions & 0 deletions packages/flutter_splash_tizen/example/tizen/App.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Tizen.Flutter.Embedding;

namespace Runner
{
public class App : FlutterApplication
{
protected override void OnCreate()
{
base.OnCreate();

GeneratedPluginRegistrant.RegisterPlugins(this);
}

static void Main(string[] args)
{
var app = new App();
app.Run(args);
}
}
}
26 changes: 26 additions & 0 deletions packages/flutter_splash_tizen/example/tizen/Runner.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<Project Sdk="Tizen.NET.Sdk/1.1.6">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>tizen40</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>portable</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="$(FlutterEmbeddingPath)" />
</ItemGroup>

<ItemGroup>
<FlutterEphemeral Include="flutter\ephemeral\**\*" />
<TizenTpkUserIncludeFiles Include="@(FlutterEphemeral)">
<TizenTpkSubDir>%(RecursiveDir)</TizenTpkSubDir>
</TizenTpkUserIncludeFiles>
</ItemGroup>

</Project>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions packages/flutter_splash_tizen/example/tizen/tizen-manifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.example.flutter_splash_tizen_example" version="1.0.0" api-version="4.0" xmlns="http://tizen.org/ns/packages">
<profile name="wearable"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this package support TV as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you confirm whether splash screen is supported on TV devices or not? If not, you should mention the fact in the package's README.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@swift-kim As far as I see - it does not run on TV. It runs on mobile and on Wearable fine.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this work for that?

Package has been tested on Mobile 6.0, Wearable 6.0 and IoT Headed 6.5 platform.

<ui-application appid="com.example.flutter_splash_tizen_example" exec="Runner.dll" type="dotnet" multiple="false" nodisplay="false" taskmanage="true" api-version="4">
<label>flutter_splash_tizen_example</label>
<icon>ic_launcher.png</icon>
<metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true"/>
<splash-screens>
<splash-screen src="test.png" type="img" indicator-display="false" orientation="portrait"/>
</splash-screens>
</ui-application>
<feature name="http://tizen.org/feature/screen.size.all"/>
</manifest>
20 changes: 20 additions & 0 deletions packages/flutter_splash_tizen/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: flutter_splash_tizen
description: Flutter-tizen package that allows to add custom splash-screen images into your apps.
homepage: https://github.com/flutter-tizen/plugins
repository: https://github.com/flutter-tizen/plugins/tree/master/packages/flutter_splash_tizen
version: 0.1.0

environment:
sdk: ">=2.12.0 <3.0.0"
flutter: ">=1.20.0"

dependencies:
flutter:
sdk: flutter
xml: ^5.3.1
yaml: ^3.1.0

dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^1.0.0
1 change: 1 addition & 0 deletions tools/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins:
camera: []
connectivity_plus: ["wearable-5.5", "tv-6.0"]
device_info_plus: ["wearable-5.5", "tv-6.0"]
flutter_splash_tizen: ["wearable-5.5"]
flutter_tts: ["wearable-5.5", "tv-6.0"]
geolocator: ["wearable-5.5"]
google_maps_flutter: []
Expand Down