protected override async void OnNormalLaunch(LaunchActivatedEventArgs e) { Frame rootFrame = Window.Current.Content as Frame; DispatcherHelper.Initialize(); accountManager = TextSecureCommunicationFactory.createManager(); RunWebsocket(); //await DirectoryHelper.refreshDirectory(); // var task = new EchoActivity("ASDFFDSA"); //Worker.AddTaskActivities(websocketTask); //App.Current.Worker.AddTaskActivities(new RefreshPreKeysTask()); if (rootFrame != null && rootFrame.Content == null) { // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter rootFrame.Navigate(typeof(MainPage), e.Arguments); } Window.Current.Activate(); }
public static async Task<bool> refreshDirectory(TextSecureAccountManager accountManager, String localNumber) { TextSecureDirectory directory = DatabaseFactory.getDirectoryDatabase(); List<string> eligibleContactNumbers = await directory.GetNumbersAsync(localNumber); List<ContactTokenDetails> activeTokens = await accountManager.getContacts(eligibleContactNumbers); if (activeTokens != null) { foreach (ContactTokenDetails activeToken in activeTokens) { Debug.WriteLine($"Token {activeToken.getNumber()}, {activeToken.getToken()}"); eligibleContactNumbers.Remove(activeToken.getNumber()); activeToken.setNumber(activeToken.getNumber()); } directory.setNumbers(activeTokens, eligibleContactNumbers); } return true; }
public static async Task<bool> refreshDirectory(TextSecureAccountManager accountManager) { return await refreshDirectory(accountManager, TextSecurePreferences.getLocalNumber()); }