Skip to content
This repository was archived by the owner on May 15, 2024. It is now read-only.

Commit 26236cd

Browse files
authored
[Tizen] Fix some issues (#1453)
* Change AppControlData string * Add type extensions for Tizen * Add missing privilege * Add Material reference * Fix type extensions for Tizen * Avoid AppAction for Tizen * Fix Launcher for OpenFileRequest
1 parent dde4b13 commit 26236cd

File tree

11 files changed

+105
-18
lines changed

11 files changed

+105
-18
lines changed

Samples/Samples.Tizen/Program.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Xamarin.Forms;
1+
using Tizen.NET.MaterialComponents;
2+
using Xamarin.Forms;
23
using Xamarin.Forms.Platform.Tizen;
34

45
namespace Samples.Tizen
@@ -11,6 +12,7 @@ protected override void OnCreate()
1112
{
1213
base.OnCreate();
1314

15+
MaterialComponents.Init(DirectoryInfo.Resource);
1416
LoadApplication(formsApp ??= new App());
1517
}
1618

Samples/Samples.Tizen/Samples.Tizen.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0">
2727
<ExcludeAssets>Runtime</ExcludeAssets>
2828
</PackageReference>
29+
<PackageReference Include="Tizen.NET.MaterialComponents" Version="0.9.9-pre2" />
2930
</ItemGroup>
3031

3132
</Project>

Samples/Samples.Tizen/tizen-manifest.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
<privileges>
1212
<privilege>http://tizen.org/privilege/appdir.shareddata</privilege>
1313
<privilege>http://tizen.org/privilege/appmanager.launch</privilege>
14+
<privilege>http://tizen.org/privilege/contact.read</privilege>
1415
<privilege>http://tizen.org/privilege/externalstorage</privilege>
16+
<privilege>http://tizen.org/privilege/externalstorage.appdata</privilege>
1517
<privilege>http://tizen.org/privilege/haptic</privilege>
1618
<privilege>http://tizen.org/privilege/internet</privilege>
1719
<privilege>http://tizen.org/privilege/led</privilege>
@@ -20,8 +22,7 @@
2022
<privilege>http://tizen.org/privilege/mediastorage</privilege>
2123
<privilege>http://tizen.org/privilege/message.read</privilege>
2224
<privilege>http://tizen.org/privilege/network.get</privilege>
23-
<privilege>http://tizen.org/privilege/externalstorage.appdata</privilege>
24-
<privilege>http://tizen.org/privilege/contact.read</privilege>
25+
<privilege>http://tizen.org/privilege/systemsettings</privilege>
2526
</privileges>
2627
<dependencies />
2728
<provides-appdefined-privileges />

Xamarin.Essentials/Email/Email.tizen.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ static Task PlatformComposeAsync(EmailMessage message)
1919
};
2020

2121
if (message.Bcc.Count > 0)
22-
appControl.ExtraData.Add("http://tizen.org/appcontrol/data/bcc", message.Bcc);
22+
appControl.ExtraData.Add(AppControlData.Bcc, message.Bcc);
2323
if (!string.IsNullOrEmpty(message.Body))
24-
appControl.ExtraData.Add("http://tizen.org/appcontrol/data/text", message.Body);
24+
appControl.ExtraData.Add(AppControlData.Text, message.Body);
2525
if (message.Cc.Count > 0)
26-
appControl.ExtraData.Add("http://tizen.org/appcontrol/data/cc", message.Cc);
26+
appControl.ExtraData.Add(AppControlData.Cc, message.Cc);
2727
if (!string.IsNullOrEmpty(message.Subject))
28-
appControl.ExtraData.Add("http://tizen.org/appcontrol/data/subject", message.Subject);
28+
appControl.ExtraData.Add(AppControlData.Subject, message.Subject);
2929
if (message.To.Count > 0)
30-
appControl.ExtraData.Add("http://tizen.org/appcontrol/data/to", message.To);
30+
appControl.ExtraData.Add(AppControlData.To, message.To);
3131

3232
AppControl.SendLaunchRequest(appControl);
3333

Xamarin.Essentials/Launcher/Launcher.tizen.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,10 @@ static Task PlatformOpenAsync(OpenFileRequest request)
4545
var appControl = new AppControl
4646
{
4747
Operation = AppControlOperations.View,
48+
Mime = "*/*",
49+
Uri = "file://" + request.File.FullPath,
4850
};
4951

50-
if (!string.IsNullOrEmpty(request.File.FullPath))
51-
appControl.ExtraData.Add("http://tizen.org/appcontrol/data/path", request.File.FullPath);
52-
5352
AppControl.SendLaunchRequest(appControl);
5453

5554
return Task.CompletedTask;

Xamarin.Essentials/Share/Share.tizen.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ static Task PlatformRequestAsync(ShareTextRequest request)
1616
};
1717

1818
if (!string.IsNullOrEmpty(request.Text))
19-
appControl.ExtraData.Add("http://tizen.org/appcontrol/data/text", request.Text);
19+
appControl.ExtraData.Add(AppControlData.Text, request.Text);
2020
if (!string.IsNullOrEmpty(request.Uri))
21-
appControl.ExtraData.Add("http://tizen.org/appcontrol/data/url", request.Uri);
21+
appControl.ExtraData.Add(AppControlData.Url, request.Uri);
2222
if (!string.IsNullOrEmpty(request.Subject))
23-
appControl.ExtraData.Add("http://tizen.org/appcontrol/data/subject", request.Subject);
23+
appControl.ExtraData.Add(AppControlData.Subject, request.Subject);
2424
if (!string.IsNullOrEmpty(request.Title))
25-
appControl.ExtraData.Add("http://tizen.org/appcontrol/data/title", request.Title);
25+
appControl.ExtraData.Add(AppControlData.Title, request.Title);
2626

2727
AppControl.SendLaunchRequest(appControl);
2828

@@ -39,10 +39,10 @@ static Task PlatformRequestAsync(ShareMultipleFilesRequest request)
3939
};
4040

4141
if (!string.IsNullOrEmpty(request.Title))
42-
appControl.ExtraData.Add("http://tizen.org/appcontrol/data/title", request.Title);
42+
appControl.ExtraData.Add(AppControlData.Title, request.Title);
4343

4444
foreach (var file in request.Files)
45-
appControl.ExtraData.Add("http://tizen.org/appcontrol/data/path", file.FullPath);
45+
appControl.ExtraData.Add(AppControlData.Path, file.FullPath);
4646

4747
AppControl.SendLaunchRequest(appControl);
4848

Xamarin.Essentials/Sms/Sms.tizen.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ static Task PlatformComposeAsync(SmsMessage message)
1919
};
2020

2121
if (!string.IsNullOrEmpty(message.Body))
22-
appControl.ExtraData.Add("http://tizen.org/appcontrol/data/text", message.Body);
22+
appControl.ExtraData.Add(AppControlData.Text, message.Body);
2323
if (message.Recipients.Count > 0)
2424
appControl.Uri += string.Join(" ", message.Recipients);
2525

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System.Drawing;
2+
using EColor = ElmSharp.Color;
3+
4+
namespace Xamarin.Essentials
5+
{
6+
public static partial class ColorExtensions
7+
{
8+
public static Color ToSystemColor(this EColor color) =>
9+
Color.FromArgb(color.A, color.R, color.G, color.B);
10+
11+
public static EColor ToPlatformColor(this Color color) =>
12+
new EColor(color.R, color.G, color.B, color.A);
13+
}
14+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System.Drawing;
2+
using EPoint = ElmSharp.Point;
3+
4+
namespace Xamarin.Essentials
5+
{
6+
public static class PointExtensions
7+
{
8+
public static Point ToSystemPoint(this EPoint point) =>
9+
new Point(point.X, point.Y);
10+
11+
public static PointF ToSystemPointF(this EPoint point) =>
12+
new PointF(point.X, point.Y);
13+
14+
public static EPoint ToPlatformPoint(this Point point) =>
15+
new EPoint() { X = point.X, Y = point.Y };
16+
17+
public static EPoint ToPlatformPoint(this PointF point) =>
18+
ToPlatformPointF(point);
19+
20+
public static EPoint ToPlatformPointF(this PointF point) =>
21+
new EPoint() { X = (int)point.X, Y = (int)point.Y };
22+
}
23+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System;
2+
using System.Drawing;
3+
using ERect = ElmSharp.Rect;
4+
5+
namespace Xamarin.Essentials
6+
{
7+
public static class RectangleExtensions
8+
{
9+
public static Rectangle ToSystemRectangle(this ERect rect) =>
10+
new Rectangle(rect.Left, rect.Top, rect.Width, rect.Height);
11+
12+
public static RectangleF ToSystemRectangleF(this ERect rect) =>
13+
new RectangleF(rect.Left, rect.Top, rect.Width, rect.Height);
14+
15+
public static ERect ToPlatformRectangle(this Rectangle rect) =>
16+
new ERect(rect.Left, rect.Top, rect.Right, rect.Bottom);
17+
18+
public static ERect ToPlatformRectangle(this RectangleF rect) =>
19+
ToPlatformRectangleF(rect);
20+
21+
public static ERect ToPlatformRectangleF(this RectangleF rect) =>
22+
new ERect((int)rect.Left, (int)rect.Top, (int)rect.Right, (int)rect.Bottom);
23+
}
24+
}

0 commit comments

Comments
 (0)