Commit 607c07a0 authored by Andreas Traczyk's avatar Andreas Traczyk Committed by Kateryna Kostiuk

ux: fix ringtone not working on first run

- adds ringtone path setting to Ring account creation to
  avoid not setting the ringtone when there are no accounts

Change-Id: I01106fcd03785631f0cd1e3172cf432ff51b5d5a
parent 2583b349
......@@ -145,11 +145,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
// make sure video is enabled
let accountDetails = self.accountService.getAccountDetails(fromAccountId:
accountDetails.set(withConfigKeyModel: ConfigKeyModel(withKey: ConfigKey.videoEnabled), withValue: "true")
// set the ringtone path
let ringtonePath = Bundle.main.url(forResource: "default", withExtension:"wav")!
accountDetails.set(withConfigKeyModel: ConfigKeyModel(withKey: ConfigKey.ringtonePath), withValue: (ringtonePath.path))
self.accountService.setAccountDetails(forAccountId:, withDetails: accountDetails)
let notificationsEnabled = accountDetails.get(withConfigKeyModel: ConfigKeyModel(withKey: ConfigKey.devicePushToken)).isEmpty ? false : true
// set ringtone path
// check if push notifications are enabled in the config
let notificationsEnabled = accountDetails.get(withConfigKeyModel: ConfigKeyModel(withKey: ConfigKey.devicePushToken)).isEmpty ? false : true
if notificationsEnabled {
......@@ -218,6 +218,8 @@ class AccountsService: AccountAdapterDelegate {
credentials: credentials,
devices: devices)
setRingtonePath(forAccountId: accountId!)
let accountModelHelper = AccountModelHelper(withAccount: account!)
var accountAddedEvent = ServiceEvent(withEventType: .accountAdded)
accountAddedEvent.addEventInput(.id, value: account?.id)
......@@ -231,6 +233,13 @@ class AccountsService: AccountAdapterDelegate {
func setRingtonePath(forAccountId accountId: String) {
let details = self.getAccountDetails(fromAccountId: accountId)
let ringtonePath = Bundle.main.url(forResource: "default", withExtension:"wav")!
details.set(withConfigKeyModel: ConfigKeyModel(withKey: ConfigKey.ringtonePath), withValue: (ringtonePath.path))
setAccountDetails(forAccountId: accountId, withDetails: details)
func linkToRingAccount(withPin pin: String, password: String) {
do {
var ringDetails = try self.getRingInitialAccountDetails()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment