-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some fixes, first implementation of notifications and check for uniqu…
…e address public key combination
- Loading branch information
Noc2
committed
Apr 7, 2018
1 parent
1311bff
commit cf999fa
Showing
55 changed files
with
1,123 additions
and
470 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
namespace Chiota.Droid.Services | ||
{ | ||
using System.Linq; | ||
|
||
using Android.Content; | ||
using Android.OS; | ||
|
||
using Chiota.Models; | ||
using Chiota.Services; | ||
|
||
using Plugin.LocalNotifications; | ||
|
||
[BroadcastReceiver] | ||
public class BackgroundReceiver : BroadcastReceiver | ||
{ | ||
public override async void OnReceive(Context context, Intent intent) | ||
{ | ||
var pm = (PowerManager)context.GetSystemService(Context.PowerService); | ||
var wakeLock = pm.NewWakeLock(WakeLockFlags.Partial, "BackgroundReceiver"); | ||
wakeLock.Acquire(); | ||
|
||
// seed needs to be stored on device!! | ||
var secureStorage = new SecureStorage(); | ||
if (secureStorage.CheckUserStored()) | ||
{ | ||
var user = await secureStorage.GetUser(); | ||
if (user != null) | ||
{ | ||
var contactApprovedList = await user.TangleMessenger.GetJsonMessageAsync<SentDataWrapper<Contact>>(user.ApprovedAddress); | ||
|
||
// Todo also message for a new contact request | ||
foreach (var contact in contactApprovedList.Where(c => !c.Data.Rejected)) | ||
{ | ||
var encryptedMessages = await user.TangleMessenger.GetMessagesAsync(contact.Data.ChatAdress); | ||
foreach (var unused in encryptedMessages.Where(c => !c.Stored)) | ||
{ | ||
CrossLocalNotifications.Current.Show(contact.Data.Name, "New Message from " + contact.Data.Name); | ||
} | ||
} | ||
} | ||
} | ||
|
||
wakeLock.Release(); | ||
} | ||
} | ||
} |
File renamed without changes.
Oops, something went wrong.