Skip to content

Commit 99a0bf2

Browse files
author
Thomas Galliker
committed
Adjust sample app to comply with latest changes/renames
1 parent 76efcf8 commit 99a0bf2

File tree

8 files changed

+56
-33
lines changed

8 files changed

+56
-33
lines changed

Samples/MauiSampleApp/Platforms/Android/Notifications/NotificationChannelSamples.cs

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,44 @@ public static IEnumerable<NotificationChannelRequest> GetAll()
2323
{
2424
ChannelId = "test_channel_1",
2525
ChannelName = "Test Channel 1",
26-
Description = "Description for test channel 1",
26+
Description = "Low priority test channel",
2727
LockscreenVisibility = NotificationVisibility.Public,
28-
Importance = NotificationImportance.High,
28+
Importance = NotificationImportance.Low,
2929
};
3030

3131
yield return new NotificationChannelRequest
3232
{
3333
ChannelId = "test_channel_2",
3434
ChannelName = "Test Channel 2",
35-
Description = "Description for test channel 2",
36-
Group = NotificationChannelGroupSamples.TestGroup1.GroupId,
35+
Description = "Default priority test channel",
3736
LockscreenVisibility = NotificationVisibility.Public,
38-
Importance = NotificationImportance.High,
37+
Importance = NotificationImportance.Default,
3938
};
4039

4140
yield return new NotificationChannelRequest
4241
{
4342
ChannelId = "test_channel_3",
4443
ChannelName = "Test Channel 3",
45-
Description = "Description for test channel 3",
44+
Description = "High priority test channel",
45+
LockscreenVisibility = NotificationVisibility.Public,
46+
Importance = NotificationImportance.High,
47+
};
48+
49+
yield return new NotificationChannelRequest
50+
{
51+
ChannelId = "test_channel_4",
52+
ChannelName = "Test Channel 4",
53+
Description = "Test channel assigned to group 1",
54+
Group = NotificationChannelGroupSamples.TestGroup1.GroupId,
55+
LockscreenVisibility = NotificationVisibility.Public,
56+
Importance = NotificationImportance.High,
57+
};
58+
59+
yield return new NotificationChannelRequest
60+
{
61+
ChannelId = "test_channel_5",
62+
ChannelName = "Test Channel 5",
63+
Description = "Test channel assigned to group 1",
4664
Group = NotificationChannelGroupSamples.TestGroup1.GroupId,
4765
LockscreenVisibility = NotificationVisibility.Public,
4866
Importance = NotificationImportance.High,
345 Bytes
Loading
319 Bytes
Loading
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
33
<color name="colorPrimary">#FDA612</color>
4-
<color name="colorPrimaryDark">#F6820C</color>
5-
<color name="colorAccent">#F6820C</color>
4+
<color name="colorPrimaryDark">#FDA612</color>
5+
<color name="colorAccent">#FDA612</color>
66
<color name="ic_default_notification_color">#FF00FF</color>
77
</resources>

Samples/MauiSampleApp/ViewModels/MainViewModel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ private async Task SubscribeToTopicAsync()
746746
try
747747
{
748748
var topic = this.Topic;
749-
this.firebasePushNotification.SubscribeTopic(topic);
749+
await this.firebasePushNotification.SubscribeTopicAsync(topic);
750750
this.UpdateSubscribedTopics();
751751
this.Topic = null;
752752
}
@@ -761,7 +761,7 @@ private async Task UnsubscribeFromTopicAsync(string topic)
761761
{
762762
try
763763
{
764-
this.firebasePushNotification.UnsubscribeTopic(topic);
764+
await this.firebasePushNotification.UnsubscribeTopicAsync(topic);
765765
this.UpdateSubscribedTopics();
766766
}
767767
catch (Exception ex)
@@ -780,7 +780,7 @@ private async Task UnsubscribeAllTopicsAsync()
780780
{
781781
try
782782
{
783-
this.firebasePushNotification.UnsubscribeAllTopics();
783+
await this.firebasePushNotification.UnsubscribeAllTopicsAsync();
784784
this.UpdateSubscribedTopics();
785785
}
786786
catch (Exception ex)

Samples/MauiSampleApp/ViewModels/NotificationCategorySamples.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ public static IEnumerable<NotificationCategory> GetAll()
2323
});
2424
yield return new NotificationCategory("contract", new[]
2525
{
26-
new NotificationAction("Accept", "Accept", NotificationActionType.Default, "accept"),
27-
new NotificationAction("Reject", "Reject", NotificationActionType.Default, "reject")
26+
new NotificationAction("Accept", "Accept", NotificationActionType.Default, "ic_radiobox_checked"),
27+
new NotificationAction("Reject", "Reject", NotificationActionType.Default, "ic_radiobox_unchecked")
2828
});
2929
yield return new NotificationCategory("dismiss",new []
3030
{
31-
new NotificationAction("dismiss","Dismiss", NotificationActionType.Default),
31+
new NotificationAction("dismiss","Dismiss", NotificationActionType.Destructive),
3232
});
3333
yield return new NotificationCategory("navigate", new []
3434
{
35-
new NotificationAction("dismiss", "Dismiss", NotificationActionType.Default),
35+
new NotificationAction("dismiss", "Dismiss", NotificationActionType.Destructive),
3636
new NotificationAction("navigate", "Navigate To", NotificationActionType.Foreground)
3737
});
3838
}

Samples/MauiSampleApp/Views/ItemTemplates/SubscribedTopicItemTemplate.xaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<ContentView
3+
x:Class="MauiSampleApp.Views.ItemTemplates.SubscribedTopicItemTemplate"
34
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
45
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
56
xmlns:vm="clr-namespace:MauiSampleApp.ViewModels"
6-
x:Class="MauiSampleApp.Views.ItemTemplates.SubscribedTopicItemTemplate"
77
x:DataType="vm:SubscribedTopicViewModel">
88

9-
<Grid
10-
Padding="4"
11-
ColumnDefinitions="*, Auto"
12-
ColumnSpacing="4">
9+
<Grid ColumnDefinitions="*, Auto" ColumnSpacing="4">
1310
<Label
1411
Grid.Column="0"
1512
FontFamily="{StaticResource FontFamily.Monospace.Regular}"

Samples/MauiSampleApp/Views/MainPage.xaml

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -267,20 +267,28 @@
267267
VerticalOptions="Start" />
268268
<VerticalStackLayout
269269
BindableLayout.ItemTemplate="{StaticResource SubscribedTopicItemTemplate}"
270-
BindableLayout.ItemsSource="{Binding SubscribedTopics}" />
270+
BindableLayout.ItemsSource="{Binding SubscribedTopics}"
271+
Spacing="4" />
272+
273+
<Grid
274+
ColumnDefinitions="*,Auto"
275+
ColumnSpacing="4">
276+
<Entry
277+
Grid.Column="0"
278+
FontFamily="{StaticResource FontFamily.Monospace.Regular}"
279+
IsSpellCheckEnabled="False"
280+
IsTextPredictionEnabled="False"
281+
Keyboard="Url"
282+
Placeholder="New topic name"
283+
Text="{Binding Topic}" />
284+
<Button
285+
Grid.Column="1"
286+
Command="{Binding SubscribeToTopicCommand}"
287+
Text="Subscribe"
288+
HorizontalOptions="Fill"
289+
VerticalOptions="Start" />
290+
</Grid>
271291

272-
<Entry
273-
FontFamily="{StaticResource FontFamily.Monospace.Regular}"
274-
IsSpellCheckEnabled="False"
275-
IsTextPredictionEnabled="False"
276-
Keyboard="Url"
277-
Placeholder="New topic name"
278-
Text="{Binding Topic}" />
279-
<Button
280-
Command="{Binding SubscribeToTopicCommand}"
281-
Text="Subscribe to topic"
282-
HorizontalOptions="Fill"
283-
VerticalOptions="Start" />
284292
<Button
285293
Command="{Binding UnsubscribeAllTopicsCommand}"
286294
LineBreakMode="MiddleTruncation"

0 commit comments

Comments
 (0)