Refactor of Config and CorePreferences

This commit is contained in:
Benoit Martins 2026-01-27 15:55:57 +01:00
parent e64c0611fb
commit d25c19ff8e
42 changed files with 231 additions and 210 deletions

View file

@ -252,19 +252,19 @@ final class ContactsManager: ObservableObject {
return
}
let base64Tmp = existingFriend?.friendList?.type == .CardDAV || linphoneAddressBookFriendList != CorePreferences.friendListInWhichStoreNewlyCreatedFriends
let base64Tmp = existingFriend?.friendList?.type == .CardDAV || linphoneAddressBookFriendList != AppServices.corePreferences.friendListInWhichStoreNewlyCreatedFriends
awaitDataWrite(data: data, name: name, prefix: prefix, base64: base64Tmp) { result in
if existingFriend?.friendList?.type != .CardDAV
|| (existingFriend?.friendList?.type == .CardDAV && linphoneFriend == self.linphoneAddressBookFriendList)
|| (editingFriend && linphoneFriend == CorePreferences.friendListInWhichStoreNewlyCreatedFriends) {
|| (editingFriend && linphoneFriend == AppServices.corePreferences.friendListInWhichStoreNewlyCreatedFriends) {
self.saveFriend(result: result, contact: contact, existingFriend: existingFriend) { resultFriend in
self.coreContext.doOnCoreQueue { core in
if let friend = resultFriend {
if linphoneFriend != self.nativeAddressBookFriendList && existingFriend == nil {
if let linphoneFL = self.linphoneFriendList, linphoneFriend == linphoneFL.displayName {
_ = linphoneFL.addFriend(linphoneFriend: friend)
} else if let linphoneFL = core.friendsLists.first(where: { $0.type == .CardDAV && $0.displayName == CorePreferences.friendListInWhichStoreNewlyCreatedFriends }) {
} else if let linphoneFL = core.friendsLists.first(where: { $0.type == .CardDAV && $0.displayName == AppServices.corePreferences.friendListInWhichStoreNewlyCreatedFriends }) {
if linphoneFL.type == .CardDAV {
_ = linphoneFL.addFriend(linphoneFriend: friend)
}
@ -337,7 +337,7 @@ final class ContactsManager: ObservableObject {
}
// Set photo
friend.photo = (friend.friendList?.type != .CardDAV && self.linphoneAddressBookFriendList == CorePreferences.friendListInWhichStoreNewlyCreatedFriends ? "file:/" : "") + result
friend.photo = (friend.friendList?.type != .CardDAV && self.linphoneAddressBookFriendList == AppServices.corePreferences.friendListInWhichStoreNewlyCreatedFriends ? "file:/" : "") + result
// Linphone subscription settings
try friend.setSubscribesenabled(newValue: false)

View file

@ -59,6 +59,36 @@ class CoreContext: ObservableObject {
var digestAuthInfoPendingPasswordUpdate: AuthInfo?
let appGroupName = "group.org.linphone.phone.msgNotification"
var teamID: String {
AppServices.config.getString(section: "app", key: "team_id", defaultString: "")
}
var earlymediaContentExtCatIdentifier: String {
AppServices.config.getString(section: "app", key: "extension_category", defaultString: "")
}
var serveraddress: String {
AppServices.config.getString(section: "app", key: "server", defaultString: "")
}
var defaultUsername: String {
AppServices.config.getString(section: "app", key: "user", defaultString: "")
}
var defaultPass: String {
AppServices.config.getString(section: "app", key: "pass", defaultString: "")
}
var pushNotificationsInterval: Int {
AppServices.config.getInt(section: "net", key: "pn-call-remote-push-interval", defaultValue: 3)
}
var voiceRecordingMaxDuration: Int {
AppServices.config.getInt(section: "app", key: "voice_recording_max_duration", defaultValue: 600000)
}
@Published var reloadID = UUID()
private init() {
@ -122,11 +152,11 @@ class CoreContext: ObservableObject {
coreQueue.async {
LoggingService.Instance.logLevel = LogLevel.Debug
Factory.Instance.logCollectionPath = Factory.Instance.getDataDir(context: UnsafeMutablePointer<Int8>(mutating: (Config.appGroupName as NSString).utf8String))
Factory.Instance.logCollectionPath = Factory.Instance.getDataDir(context: UnsafeMutablePointer<Int8>(mutating: (self.appGroupName as NSString).utf8String))
Factory.Instance.enableLogCollection(state: LogCollectionState.Enabled)
Log.info("Checking if linphonerc file exists already. If not, creating one as a copy of linphonerc-default")
if let rcDir = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: Config.appGroupName)?
if let rcDir = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: self.appGroupName)?
.appendingPathComponent("Library/Preferences/linphone") {
let rcFileUrl = rcDir.appendingPathComponent("linphonerc")
if !FileManager.default.fileExists(atPath: rcFileUrl.path) {
@ -144,7 +174,7 @@ class CoreContext: ObservableObject {
}
}
self.mCore = try? Factory.Instance.createSharedCoreWithConfig(config: Config.get(), systemContext: Unmanaged.passUnretained(coreQueue).toOpaque(), appGroupId: Config.appGroupName, mainCore: true)
self.mCore = try? Factory.Instance.createSharedCoreWithConfig(config: AppServices.config, systemContext: Unmanaged.passUnretained(coreQueue).toOpaque(), appGroupId: self.appGroupName, mainCore: true)
self.mCore.callkitEnabled = true
self.mCore.pushNotificationEnabled = true
@ -325,7 +355,7 @@ class CoreContext: ObservableObject {
}
}, onConfiguringStatus: { (_: Core, status: ConfiguringState, message: String) in
Log.info("New configuration state is \(status) = \(message)\n")
let themeMainColor = CorePreferences.themeMainColor
let themeMainColor = AppServices.corePreferences.themeMainColor
SharedMainViewModel.shared.updateConfigChanges()
DispatchQueue.main.async {
if status == ConfiguringState.Successful {
@ -524,7 +554,7 @@ class CoreContext: ObservableObject {
}
func copyDatabaseFileToDocumentsDirectory() {
if let rcDir = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: Config.appGroupName)?
if let rcDir = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: self.appGroupName)?
.appendingPathComponent("Library/Application Support/linphone") {
let rcFileUrl = rcDir.appendingPathComponent("linphone.db")
let directory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first
@ -542,6 +572,16 @@ class CoreContext: ObservableObject {
}
}
enum AppServices {
static let config = Config.newForSharedCore(
appGroupId: "group.org.linphone.phone.msgNotification",
configFilename: "linphonerc",
factoryConfigFilename: FileUtil.bundleFilePath("linphonerc-factory")
)!
static let corePreferences = CorePreferences(config: config)
}
// swiftlint:enable line_length
// swiftlint:enable cyclomatic_complexity
// swiftlint:enable identifier_name

View file

@ -21,219 +21,226 @@ import Foundation
import linphonesw
class CorePreferences {
static var printLogsInLogcat: Bool {
private let config: Config
init(config: Config) {
self.config = config
}
var printLogsInLogcat: Bool {
get {
return Config.get().getBool(section: "app", key: "debug", defaultValue: true)
config.getBool(section: "app", key: "debug", defaultValue: true)
}
set {
Config.get().setBool(section: "app", key: "debug", value: newValue)
config.setBool(section: "app", key: "debug", value: newValue)
}
}
static var firstLaunch: Bool {
var firstLaunch: Bool {
get {
return Config.get().getBool(section: "app", key: "first_6.0_launch", defaultValue: true)
config.getBool(section: "app", key: "first_6.0_launch", defaultValue: true)
}
set {
Config.get().setBool(section: "app", key: "first_6.0_launch", value: newValue)
config.setBool(section: "app", key: "first_6.0_launch", value: newValue)
}
}
static var linphoneConfigurationVersion: Int {
var linphoneConfigurationVersion: Int {
get {
return Config.get().getInt(section: "app", key: "config_version", defaultValue: 52005)
config.getInt(section: "app", key: "config_version", defaultValue: 52005)
}
set {
Config.get().setInt(section: "app", key: "config_version", value: newValue)
config.setInt(section: "app", key: "config_version", value: newValue)
}
}
static var checkForUpdateServerUrl: String {
var checkForUpdateServerUrl: String {
get {
let raw = Config.get().getString(section: "misc", key: "version_check_url_root", defaultString: "")
let raw = config.getString(section: "misc", key: "version_check_url_root", defaultString: "")
return safeString(raw, defaultValue: "")
}
set {
Config.get().setString(section: "misc", key: "version_check_url_root", value: newValue)
config.setString(section: "misc", key: "version_check_url_root", value: newValue)
}
}
static var conditionsAndPrivacyPolicyAccepted: Bool {
var conditionsAndPrivacyPolicyAccepted: Bool {
get {
return Config.get().getBool(section: "app", key: "read_and_agree_terms_and_privacy", defaultValue: false)
config.getBool(section: "app", key: "read_and_agree_terms_and_privacy", defaultValue: false)
}
set {
Config.get().setBool(section: "app", key: "read_and_agree_terms_and_privacy", value: newValue)
config.setBool(section: "app", key: "read_and_agree_terms_and_privacy", value: newValue)
}
}
static var publishPresence: Bool {
var publishPresence: Bool {
get {
return Config.get().getBool(section: "app", key: "publish_presence", defaultValue: true)
config.getBool(section: "app", key: "publish_presence", defaultValue: true)
}
set {
Config.get().setBool(section: "app", key: "publish_presence", value: newValue)
config.setBool(section: "app", key: "publish_presence", value: newValue)
}
}
static var keepServiceAlive: Bool {
var keepServiceAlive: Bool {
get {
return Config.get().getBool(section: "app", key: "keep_service_alive", defaultValue: false)
config.getBool(section: "app", key: "keep_service_alive", defaultValue: false)
}
set {
Config.get().setBool(section: "app", key: "keep_service_alive", value: newValue)
config.setBool(section: "app", key: "keep_service_alive", value: newValue)
}
}
static var deviceName: String {
var deviceName: String {
get {
let raw = Config.get().getString(section: "app", key: "device", defaultString: "").trimmingCharacters(in: .whitespaces)
let raw = config.getString(section: "app", key: "device", defaultString: "").trimmingCharacters(in: .whitespaces)
return safeString(raw, defaultValue: "")
}
set {
Config.get().setString(section: "app", key: "device", value: newValue.trimmingCharacters(in: .whitespaces))
config.setString(section: "app", key: "device", value: newValue.trimmingCharacters(in: .whitespaces))
}
}
static var routeAudioToSpeakerWhenVideoIsEnabled: Bool {
var routeAudioToSpeakerWhenVideoIsEnabled: Bool {
get {
return Config.get().getBool(section: "app", key: "route_audio_to_speaker_when_video_enabled", defaultValue: true)
config.getBool(section: "app", key: "route_audio_to_speaker_when_video_enabled", defaultValue: true)
}
set {
Config.get().setBool(section: "app", key: "route_audio_to_speaker_when_video_enabled", value: newValue)
config.setBool(section: "app", key: "route_audio_to_speaker_when_video_enabled", value: newValue)
}
}
static var automaticallyStartCallRecording: Bool {
var automaticallyStartCallRecording: Bool {
get {
return Config.get().getBool(section: "app", key: "auto_start_call_record", defaultValue: false)
return config.getBool(section: "app", key: "auto_start_call_record", defaultValue: false)
}
set {
Config.get().setBool(section: "app", key: "auto_start_call_record", value: newValue)
config.setBool(section: "app", key: "auto_start_call_record", value: newValue)
}
}
static var showDialogWhenCallingDeviceUuidDirectly: Bool {
var showDialogWhenCallingDeviceUuidDirectly: Bool {
get {
return Config.get().getBool(section: "app", key: "show_confirmation_dialog_zrtp_trust_call", defaultValue: true)
return config.getBool(section: "app", key: "show_confirmation_dialog_zrtp_trust_call", defaultValue: true)
}
set {
Config.get().setBool(section: "app", key: "show_confirmation_dialog_zrtp_trust_call", value: newValue)
config.setBool(section: "app", key: "show_confirmation_dialog_zrtp_trust_call", value: newValue)
}
}
static var markConversationAsReadWhenDismissingMessageNotification: Bool {
var markConversationAsReadWhenDismissingMessageNotification: Bool {
get {
return Config.get().getBool(section: "app", key: "mark_as_read_notif_dismissal", defaultValue: false)
config.getBool(section: "app", key: "mark_as_read_notif_dismissal", defaultValue: false)
}
set {
Config.get().setBool(section: "app", key: "mark_as_read_notif_dismissal", value: newValue)
config.setBool(section: "app", key: "mark_as_read_notif_dismissal", value: newValue)
}
}
static var contactsFilter: String {
var contactsFilter: String {
get {
let raw = Config.get().getString(section: "ui", key: "contacts_filter", defaultString: "")
let raw = config.getString(section: "ui", key: "contacts_filter", defaultString: "")
return safeString(raw, defaultValue: "")
}
set {
Config.get().setString(section: "ui", key: "contacts_filter", value: newValue)
config.setString(section: "ui", key: "contacts_filter", value: newValue)
}
}
static var disableAddContact: Bool {
var disableAddContact: Bool {
get {
return Config.get().getBool(section: "ui", key: "disable_add_contact", defaultValue: false)
config.getBool(section: "ui", key: "disable_add_contact", defaultValue: false)
}
set {
Config.get().setBool(section: "ui", key: "disable_add_contact", value: newValue)
config.setBool(section: "ui", key: "disable_add_contact", value: newValue)
}
}
static var showFavoriteContacts: Bool {
var showFavoriteContacts: Bool {
get {
return Config.get().getBool(section: "ui", key: "show_favorites_contacts", defaultValue: true)
config.getBool(section: "ui", key: "show_favorites_contacts", defaultValue: true)
}
set {
Config.get().setBool(section: "ui", key: "show_favorites_contacts", value: newValue)
config.setBool(section: "ui", key: "show_favorites_contacts", value: newValue)
}
}
static var friendListInWhichStoreNewlyCreatedFriends: String {
var friendListInWhichStoreNewlyCreatedFriends: String {
get {
return Config.get().getString(section: "app", key: "friend_list_to_store_newly_created_contacts", defaultString: "Linphone address-book")
config.getString(section: "app", key: "friend_list_to_store_newly_created_contacts", defaultString: "Linphone address-book")
}
set {
Config.get().setString(section: "app", key: "friend_list_to_store_newly_created_contacts", value: newValue)
config.setString(section: "app", key: "friend_list_to_store_newly_created_contacts", value: newValue)
}
}
static var voiceRecordingMaxDuration: Int {
var voiceRecordingMaxDuration: Int {
get {
return Config.get().getInt(section: "app", key: "voice_recording_max_duration", defaultValue: 600000)
config.getInt(section: "app", key: "voice_recording_max_duration", defaultValue: 600000)
}
set {
Config.get().setInt(section: "app", key: "voice_recording_max_duration", value: newValue)
config.setInt(section: "app", key: "voice_recording_max_duration", value: newValue)
}
}
static var darkMode: Int {
var darkMode: Int {
get {
if !darkModeAllowed { return 0 }
return Config.get().getInt(section: "app", key: "dark_mode", defaultValue: -1)
return config.getInt(section: "app", key: "dark_mode", defaultValue: -1)
}
set {
Config.get().setInt(section: "app", key: "dark_mode", value: newValue)
config.setInt(section: "app", key: "dark_mode", value: newValue)
}
}
static var enableSecureMode: Bool {
var enableSecureMode: Bool {
get {
return Config.get().getBool(section: "ui", key: "enable_secure_mode", defaultValue: true)
config.getBool(section: "ui", key: "enable_secure_mode", defaultValue: true)
}
set {
Config.get().setBool(section: "ui", key: "enable_secure_mode", value: newValue)
config.setBool(section: "ui", key: "enable_secure_mode", value: newValue)
}
}
static var themeMainColor: String {
var themeMainColor: String {
get {
let raw = Config.get().getString(section: "ui", key: "theme_main_color", defaultString: "orange")
let raw = config.getString(section: "ui", key: "theme_main_color", defaultString: "orange")
return safeString(raw, defaultValue: "orange")
}
set {
Config.get().setString(section: "ui", key: "theme_main_color", value: newValue)
config.setString(section: "ui", key: "theme_main_color", value: newValue)
}
}
static var themeAboutPictureUrl: String? {
var themeAboutPictureUrl: String? {
get {
return Config.get().getString(section: "ui", key: "theme_about_picture_url", defaultString: nil)
return config.getString(section: "ui", key: "theme_about_picture_url", defaultString: nil)
}
}
static var darkModeAllowed: Bool {
return Config.get().getBool(section: "ui", key: "dark_mode_allowed", defaultValue: true)
var darkModeAllowed: Bool {
config.getBool(section: "ui", key: "dark_mode_allowed", defaultValue: true)
}
static var changeMainColorAllowed: Bool {
return Config.get().getBool(section: "ui", key: "change_main_color_allowed", defaultValue: false)
var changeMainColorAllowed: Bool {
config.getBool(section: "ui", key: "change_main_color_allowed", defaultValue: false)
}
static var hideSettings: Bool {
return Config.get().getBool(section: "ui", key: "hide_settings", defaultValue: false)
var hideSettings: Bool {
config.getBool(section: "ui", key: "hide_settings", defaultValue: false)
}
static var maxAccountsCount: Int {
return Config.get().getInt(section: "ui", key: "max_account", defaultValue: 0)
var maxAccountsCount: Int {
config.getInt(section: "ui", key: "max_account", defaultValue: 0)
}
/*
static var configPath: String {
var configPath: String {
return context.view.window?.rootViewController?.view.frame.origin.x ?? "" + "/.linphonerc"
}
static var factoryConfigPath: String {
var factoryConfigPath: String {
return context.view.window?.rootViewController?.view.frame.origin.x ?? "" + "/linphonerc"
}
@ -243,67 +250,67 @@ class CorePreferences {
}
*/
static var vfsEnabled: Bool {
var vfsEnabled: Bool {
get {
return Config.get().getBool(section: "app", key: "vfs_enabled", defaultValue: false)
config.getBool(section: "app", key: "vfs_enabled", defaultValue: false)
}
set {
Config.get().setBool(section: "app", key: "vfs_enabled", value: newValue)
config.setBool(section: "app", key: "vfs_enabled", value: newValue)
}
}
static var acceptEarlyMedia: Bool {
var acceptEarlyMedia: Bool {
get {
return Config.get().getBool(section: "sip", key: "incoming_calls_early_media", defaultValue: false)
config.getBool(section: "sip", key: "incoming_calls_early_media", defaultValue: false)
}
set {
Config.get().setBool(section: "sip", key: "incoming_calls_early_media", value: newValue)
config.setBool(section: "sip", key: "incoming_calls_early_media", value: newValue)
}
}
static var allowOutgoingEarlyMedia: Bool {
var allowOutgoingEarlyMedia: Bool {
get {
return Config.get().getBool(section: "sip", key: "real_early_media", defaultValue: false)
config.getBool(section: "sip", key: "real_early_media", defaultValue: false)
}
set {
Config.get().setBool(section: "sip", key: "real_early_media", value: newValue)
config.setBool(section: "sip", key: "real_early_media", value: newValue)
}
}
static var defaultDomain: String {
var defaultDomain: String {
get {
let raw = Config.get().getString(section: "app", key: "default_domain", defaultString: "sip.linphone.org")
let raw = config.getString(section: "app", key: "default_domain", defaultString: "sip.linphone.org")
return safeString(raw, defaultValue: "sip.linphone.org")
}
set {
Config.get().setString(section: "app", key: "default_domain", value: newValue)
config.setString(section: "app", key: "default_domain", value: newValue)
}
}
static var disableChatFeature: Bool {
var disableChatFeature: Bool {
get {
return Config.get().getBool(section: "ui", key: "disable_chat_feature", defaultValue: false)
config.getBool(section: "ui", key: "disable_chat_feature", defaultValue: false)
}
set {
Config.get().setBool(section: "ui", key: "disable_chat_feature", value: newValue)
config.setBool(section: "ui", key: "disable_chat_feature", value: newValue)
}
}
static var disableMeetings: Bool {
var disableMeetings: Bool {
get {
return Config.get().getBool(section: "ui", key: "disable_meetings_feature", defaultValue: false)
config.getBool(section: "ui", key: "disable_meetings_feature", defaultValue: false)
}
set {
Config.get().setBool(section: "ui", key: "disable_meetings_feature", value: newValue)
config.setBool(section: "ui", key: "disable_meetings_feature", value: newValue)
}
}
static var hideSipAddresses: Bool {
var hideSipAddresses: Bool {
get {
return Config.get().getBool(section: "ui", key: "hide_sip_addresses", defaultValue: false)
config.getBool(section: "ui", key: "hide_sip_addresses", defaultValue: false)
}
set {
Config.get().setBool(section: "ui", key: "hide_sip_addresses", value: newValue)
config.setBool(section: "ui", key: "hide_sip_addresses", value: newValue)
}
}
@ -322,7 +329,7 @@ class CorePreferences {
}
}
private static func safeString(_ raw: String?, defaultValue: String = "") -> String {
private func safeString(_ raw: String?, defaultValue: String = "") -> String {
guard let raw = raw else { return defaultValue }
if let data = raw.data(using: .utf8) {
return String(decoding: data, as: UTF8.self)

View file

@ -2,6 +2,6 @@ import Foundation
public enum AppGitInfo {
public static let branch = "master"
public static let commit = "dc5f131ce"
public static let commit = "e64c0611f"
public static let tag = "6.1.0-alpha"
}

View file

@ -526,7 +526,7 @@ struct CallView: View {
.padding(.top)
.default_text_style_white(styleSize: 22)
if !CorePreferences.hideSipAddresses {
if !AppServices.corePreferences.hideSipAddresses {
Text(callViewModel.remoteAddressCleanedString)
.default_text_style_white_300(styleSize: 16)
}
@ -2281,7 +2281,7 @@ struct CallView: View {
.frame(height: geo.size.height * 0.15)
HStack(spacing: 0) {
if !CorePreferences.disableChatFeature && callViewModel.chatEnabled {
if !AppServices.corePreferences.disableChatFeature && callViewModel.chatEnabled {
VStack {
Button {
callViewModel.createConversation()
@ -2441,7 +2441,7 @@ struct CallView: View {
.frame(width: geo.size.width * 0.24, height: geo.size.width * 0.24)
.hidden()
if CorePreferences.disableChatFeature || !callViewModel.chatEnabled {
if AppServices.corePreferences.disableChatFeature || !callViewModel.chatEnabled {
VStack {
Button {
} label: {
@ -2707,7 +2707,7 @@ struct CallView: View {
.frame(width: geo.size.width * 0.125, height: geo.size.width * 0.125)
}
if !CorePreferences.disableChatFeature && callViewModel.chatEnabled {
if !AppServices.corePreferences.disableChatFeature && callViewModel.chatEnabled {
VStack {
Button {
callViewModel.createConversation()

View file

@ -1299,7 +1299,7 @@ class CallViewModel: ObservableObject {
if let chatParams = params.chatParams {
chatParams.ephemeralLifetime = 0 // Make sure ephemeral is disabled by default
let sameDomain = remoteAddress?.domain == CorePreferences.defaultDomain && remoteAddress?.domain == account.params?.domain
let sameDomain = remoteAddress?.domain == AppServices.corePreferences.defaultDomain && remoteAddress?.domain == account.params?.domain
if account.params != nil && (account.params!.instantMessagingEncryptionMandatory && sameDomain) {
Log.info(
"\(CallViewModel.TAG) Account is in secure mode & domain matches, requesting E2E encryption"

View file

@ -32,7 +32,7 @@ struct ContactsView: View {
ZStack(alignment: .bottomTrailing) {
ContactsFragment(isShowDeletePopup: $isShowDeletePopup, text: $text)
if !CorePreferences.disableAddContact {
if !AppServices.corePreferences.disableAddContact {
Button {
withAnimation {
contactsListViewModel.selectedEditFriend = nil

View file

@ -40,7 +40,7 @@ struct ContactInnerActionsFragment: View {
var actionEditButton: () -> Void
var body: some View {
if !CorePreferences.hideSipAddresses || (CorePreferences.hideSipAddresses && !contactAvatarModel.phoneNumbersWithLabel.isEmpty) {
if !AppServices.corePreferences.hideSipAddresses || (AppServices.corePreferences.hideSipAddresses && !contactAvatarModel.phoneNumbersWithLabel.isEmpty) {
HStack(alignment: .center) {
Text("contact_details_numbers_and_addresses_title")
.default_text_style_800(styleSize: 15)
@ -67,7 +67,7 @@ struct ContactInnerActionsFragment: View {
if informationIsOpen {
VStack(spacing: 0) {
if !CorePreferences.hideSipAddresses {
if !AppServices.corePreferences.hideSipAddresses {
ForEach(0..<contactAvatarModel.addresses.count, id: \.self) { index in
HStack {
HStack {

View file

@ -181,7 +181,7 @@ struct ContactInnerFragment: View {
}
})
if !CorePreferences.disableChatFeature {
if !AppServices.corePreferences.disableChatFeature {
Spacer()
Button(action: {

View file

@ -545,7 +545,7 @@ struct EditContactFragment: View {
prefix: prefix,
contact: newContact,
existingFriend: existingFriend,
linphoneFriend: CorePreferences.friendListInWhichStoreNewlyCreatedFriends
linphoneFriend: AppServices.corePreferences.friendListInWhichStoreNewlyCreatedFriends
)
}
}

View file

@ -65,7 +65,7 @@ class ContactsListViewModel: ObservableObject {
guard let chatParams = params.chatParams else { return }
chatParams.ephemeralLifetime = 0 // Make sure ephemeral is disabled by default
let sameDomain = remote.domain == CorePreferences.defaultDomain && remote.domain == account!.params?.domain
let sameDomain = remote.domain == AppServices.corePreferences.defaultDomain && remote.domain == account!.params?.domain
if account!.params != nil && (account!.params!.instantMessagingEncryptionMandatory && sameDomain) {
Log.info("\(ConversationForwardMessageViewModel.TAG) Account is in secure mode & domain matches, creating an E2E encrypted conversation")
chatParams.backend = ChatRoom.Backend.FlexisipChat

View file

@ -283,7 +283,7 @@ struct ConversationForwardMessageFragment: View {
HStack {
if index < contactsManager.lastSearchSuggestions.count
&& contactsManager.lastSearchSuggestions[index].address != nil {
if contactsManager.lastSearchSuggestions[index].address!.domain != CorePreferences.defaultDomain {
if contactsManager.lastSearchSuggestions[index].address!.domain != AppServices.corePreferences.defaultDomain {
Image(uiImage: contactsManager.textToImage(
firstName: String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)),
lastName: ""))

View file

@ -104,7 +104,7 @@ struct ConversationInfoFragment: View {
.frame(maxWidth: .infinity)
.padding(.top, 10)
if !CorePreferences.hideSipAddresses {
if !AppServices.corePreferences.hideSipAddresses {
Text(conversationViewModel.participantConversationModel.first?.address ?? "")
.foregroundStyle(Color.grayMain2c700)
.multilineTextAlignment(.center)
@ -358,7 +358,7 @@ struct ConversationInfoFragment: View {
let friendIndex = contactsManager.lastSearch.firstIndex(
where: {$0.friend!.addresses.contains(where: {$0.asStringUriOnly() == addressConv})})
let disableAddContact = CorePreferences.disableAddContact
let disableAddContact = AppServices.corePreferences.disableAddContact
if (!disableAddContact || (disableAddContact && friendIndex != nil)) {
Button(
@ -538,7 +538,7 @@ struct ConversationInfoFragment: View {
let friendIndex = contactsManager.lastSearch.firstIndex(
where: {$0.friend!.addresses.contains(where: {$0.asStringUriOnly() == addressConv})})
let disableAddContact = CorePreferences.disableAddContact
let disableAddContact = AppServices.corePreferences.disableAddContact
if !SharedMainViewModel.shared.displayedConversation!.isGroup && (!disableAddContact || (disableAddContact && friendIndex != nil)) {
Button(

View file

@ -265,7 +265,7 @@ struct StartConversationFragment: View {
HStack {
if index < contactsManager.lastSearchSuggestions.count
&& contactsManager.lastSearchSuggestions[index].address != nil {
if contactsManager.lastSearchSuggestions[index].address!.domain != CorePreferences.defaultDomain {
if contactsManager.lastSearchSuggestions[index].address!.domain != AppServices.corePreferences.defaultDomain {
Image(uiImage: contactsManager.textToImage(
firstName: String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)),
lastName: ""))

View file

@ -108,7 +108,7 @@ class ConversationForwardMessageViewModel: ObservableObject {
guard let chatParams = params.chatParams else { return }
chatParams.ephemeralLifetime = 0 // Make sure ephemeral is disabled by default
let sameDomain = remote.domain == CorePreferences.defaultDomain && remote.domain == account!.params?.domain
let sameDomain = remote.domain == AppServices.corePreferences.defaultDomain && remote.domain == account!.params?.domain
if account!.params != nil && (account!.params!.instantMessagingEncryptionMandatory && sameDomain) {
Log.info("\(ConversationForwardMessageViewModel.TAG) Account is in secure mode & domain matches, creating an E2E encrypted conversation")
chatParams.backend = ChatRoom.Backend.FlexisipChat

View file

@ -3593,7 +3593,7 @@ class AudioRecorder: NSObject, ObservableObject {
func startTimer() {
DispatchQueue.main.async {
self.recordingTime = 0
let maxVoiceRecordDuration = Config.voiceRecordingMaxDuration
let maxVoiceRecordDuration = CoreContext.shared.voiceRecordingMaxDuration
self.timer = Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true) { _ in // More frequent updates
self.recordingTime += 0.1
self.updateSoundPower()

View file

@ -179,7 +179,7 @@ class StartConversationViewModel: ObservableObject {
guard let chatParams = params.chatParams else { return }
chatParams.ephemeralLifetime = 0 // Make sure ephemeral is disabled by default
let sameDomain = remote.domain == CorePreferences.defaultDomain && remote.domain == account!.params?.domain
let sameDomain = remote.domain == AppServices.corePreferences.defaultDomain && remote.domain == account!.params?.domain
if account!.params != nil && (account!.params!.instantMessagingEncryptionMandatory && sameDomain) {
Log.info("\(StartConversationViewModel.TAG) Account is in secure mode & domain matches, creating an E2E encrypted conversation")
chatParams.backend = ChatRoom.Backend.FlexisipChat

View file

@ -123,7 +123,7 @@ struct SideMenuAccountRow: View {
)
}
if model.notificationsCount > 0 && !CorePreferences.disableChatFeature {
if model.notificationsCount > 0 && !AppServices.corePreferences.disableChatFeature {
VStack {
Text(String(model.notificationsCount))
.foregroundStyle(.white)

View file

@ -245,7 +245,7 @@ struct DebugFragment: View {
func showConfigFile() {
Log.info("[DebugFragment][showConfigFile] Dumping & displaying Core's config")
if let rcDir = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: Config.appGroupName)?
if let rcDir = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: CoreContext.shared.appGroupName)?
.appendingPathComponent("Library/Preferences/linphone") {
let rcFileUrl = rcDir.appendingPathComponent("linphonerc")
if FileManager.default.fileExists(atPath: rcFileUrl.path) {

View file

@ -73,7 +73,7 @@ struct HelpFragment: View {
ScrollView {
VStack(spacing: 0) {
VStack(spacing: 20) {
if let urlString = CorePreferences.themeAboutPictureUrl,
if let urlString = AppServices.corePreferences.themeAboutPictureUrl,
let url = URL(string: urlString) {
AsyncImage(url: url) { phase in
switch phase {

View file

@ -118,7 +118,7 @@ class HelpViewModel: ObservableObject {
func toggleLogcat() {
let newValue = !self.logcat
CoreContext.shared.doOnCoreQueue { core in
CorePreferences.printLogsInLogcat = newValue
AppServices.corePreferences.printLogsInLogcat = newValue
Factory.Instance.enableLogcatLogs(newValue)
self.logcat = newValue
}

View file

@ -70,7 +70,7 @@ struct HistoryContactFragment: View {
Spacer()
Menu {
let disableAddContact = CorePreferences.disableAddContact
let disableAddContact = AppServices.corePreferences.disableAddContact
let isFriend = historyModel.isFriend == true
if !historyModel.isConf && (!disableAddContact || (disableAddContact && isFriend)) {
@ -189,7 +189,7 @@ struct HistoryContactFragment: View {
.frame(maxWidth: .infinity)
.padding(.top, 10)
if !CorePreferences.hideSipAddresses {
if !AppServices.corePreferences.hideSipAddresses {
Text(historyModel.address)
.foregroundStyle(Color.grayMain2c700)
.multilineTextAlignment(.center)
@ -258,7 +258,7 @@ struct HistoryContactFragment: View {
}
})
if !CorePreferences.disableChatFeature {
if !AppServices.corePreferences.disableChatFeature {
Spacer()
Button(action: {

View file

@ -59,7 +59,7 @@ struct HistoryListBottomSheet: View {
Spacer()
let disableAddContact = CorePreferences.disableAddContact
let disableAddContact = AppServices.corePreferences.disableAddContact
let isFriend = historyListViewModel.selectedCall?.isFriend == true
if !disableAddContact || (disableAddContact && isFriend) {

View file

@ -393,7 +393,7 @@ struct StartCallFragment: View {
HStack {
if index < contactsManager.lastSearchSuggestions.count
&& contactsManager.lastSearchSuggestions[index].address != nil {
if contactsManager.lastSearchSuggestions[index].address!.domain != CorePreferences.defaultDomain {
if contactsManager.lastSearchSuggestions[index].address!.domain != AppServices.corePreferences.defaultDomain {
Image(uiImage: contactsManager.textToImage(
firstName: String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)),
lastName: ""))

View file

@ -254,7 +254,7 @@ class HistoryListViewModel: ObservableObject {
guard let chatParams = params.chatParams else { return }
chatParams.ephemeralLifetime = 0 // Make sure ephemeral is disabled by default
let sameDomain = remote.domain == CorePreferences.defaultDomain && remote.domain == account!.params?.domain
let sameDomain = remote.domain == AppServices.corePreferences.defaultDomain && remote.domain == account!.params?.domain
if account!.params != nil && (account!.params!.instantMessagingEncryptionMandatory && sameDomain) {
Log.info("\(ConversationForwardMessageViewModel.TAG) Account is in secure mode & domain matches, creating an E2E encrypted conversation")
chatParams.backend = ChatRoom.Backend.FlexisipChat

View file

@ -51,7 +51,7 @@ class StartCallViewModel: ObservableObject {
}
func updateGroupCallButtonVisibility(core: Core) {
let hideGroupCall = CorePreferences.disableMeetings ||
let hideGroupCall = AppServices.corePreferences.disableMeetings ||
!LinphoneUtils.isRemoteConferencingAvailable(core: core) ||
core.callsNb > 0
DispatchQueue.main.async {

View file

@ -290,7 +290,7 @@ struct AddParticipantsFragment: View {
HStack {
if index < contactsManager.lastSearchSuggestions.count
&& contactsManager.lastSearchSuggestions[index].address != nil {
if contactsManager.lastSearchSuggestions[index].address!.domain != CorePreferences.defaultDomain {
if contactsManager.lastSearchSuggestions[index].address!.domain != AppServices.corePreferences.defaultDomain {
Image(uiImage: contactsManager.textToImage(
firstName: String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)),
lastName: ""))

View file

@ -301,7 +301,7 @@ struct ScheduleMeetingFragment: View {
}
}
if !CorePreferences.disableChatFeature {
if !AppServices.corePreferences.disableChatFeature {
Rectangle()
.foregroundStyle(.clear)
.frame(height: 1)

View file

@ -221,7 +221,7 @@ class MeetingViewModel: ObservableObject {
}
}
if self.sendInvitations && !CorePreferences.disableChatFeature {
if self.sendInvitations && !AppServices.corePreferences.disableChatFeature {
Log.info("\(MeetingViewModel.TAG) User asked for invitations to be sent, let's do it")
self.sendIcsInvitation(core: core)
} else {

View file

@ -157,7 +157,7 @@ class MeetingsListViewModel: ObservableObject {
let mSchedulerDelegate = ConferenceSchedulerDelegateStub(onStateChanged: { (_: ConferenceScheduler, state: ConferenceScheduler.State) in
Log.info("\(MeetingViewModel.TAG) Conference state changed \(state)")
if state == ConferenceScheduler.State.Ready {
if !CorePreferences.disableChatFeature {
if !AppServices.corePreferences.disableChatFeature {
self.sendIcsInvitation(core: core, conferenceScheduler: conferenceScheduler)
}

View file

@ -270,7 +270,7 @@ struct AccountProfileFragment: View {
if accountModel.avatarModel != nil {
VStack(spacing: 0) {
VStack(spacing: 30) {
if !CorePreferences.hideSipAddresses {
if !AppServices.corePreferences.hideSipAddresses {
HStack {
Text(String(localized: "sip_address") + ":")
.default_text_style_700(styleSize: 15)

View file

@ -85,7 +85,7 @@ class CardDavViewModel: ObservableObject {
}
let isReadOnlyTmp = friendList.isReadOnly
let friendListInWhichStoreNewlyCreatedFriendsTmp = CorePreferences.friendListInWhichStoreNewlyCreatedFriends
let friendListInWhichStoreNewlyCreatedFriendsTmp = AppServices.corePreferences.friendListInWhichStoreNewlyCreatedFriends
let uriTmp = friendList.uri ?? ""
DispatchQueue.main.async {
self.isEdit = true
@ -104,9 +104,9 @@ class CardDavViewModel: ObservableObject {
self.coreContext.doOnCoreQueue { core in
if self.isEdit, let friendList = self.friendList {
let name = friendList.displayName
if name == CorePreferences.friendListInWhichStoreNewlyCreatedFriends {
if name == AppServices.corePreferences.friendListInWhichStoreNewlyCreatedFriends {
Log.info("\(CardDavViewModel.TAG) Deleting friend list configured to be used to store newly created friends, updating default friend list back to \(self.linphoneAddressBookFriendList)")
CorePreferences.friendListInWhichStoreNewlyCreatedFriends = self.linphoneAddressBookFriendList
AppServices.corePreferences.friendListInWhichStoreNewlyCreatedFriends = self.linphoneAddressBookFriendList
}
if let tempRemoteFriendList = core.getFriendListByName(name: self.tempRemoteAddressBookFriendList) {
@ -201,9 +201,9 @@ class CardDavViewModel: ObservableObject {
Log.info("\(CardDavViewModel.TAG) CardDAV friend list \(name) created with server URL \(server), synchronizing it")
}
if !self.storeNewContactsInIt && CorePreferences.friendListInWhichStoreNewlyCreatedFriends == name {
if !self.storeNewContactsInIt && AppServices.corePreferences.friendListInWhichStoreNewlyCreatedFriends == name {
Log.info("\(CardDavViewModel.TAG) No longer using friend list \(name) as default friend list, switching back to \(self.linphoneAddressBookFriendList)")
CorePreferences.friendListInWhichStoreNewlyCreatedFriends = self.linphoneAddressBookFriendList
AppServices.corePreferences.friendListInWhichStoreNewlyCreatedFriends = self.linphoneAddressBookFriendList
}
if let friendList = self.friendList {
@ -231,13 +231,13 @@ class CardDavViewModel: ObservableObject {
let name = self.displayName
if self.storeNewContactsInIt {
let previous = CorePreferences.friendListInWhichStoreNewlyCreatedFriends
let previous = AppServices.corePreferences.friendListInWhichStoreNewlyCreatedFriends
if friendList.isReadOnly {
Log.warn("\(CardDavViewModel.TAG) User asked to add newly created contacts in this friend list but it is read only, keep currently default friend list \(previous)")
self.storeNewContactsInIt = false
} else {
Log.info("\(CardDavViewModel.TAG) Updating default friend list to store newly created contacts from \(previous) to \(name)")
CorePreferences.friendListInWhichStoreNewlyCreatedFriends = name
AppServices.corePreferences.friendListInWhichStoreNewlyCreatedFriends = name
}
DispatchQueue.main.async {

View file

@ -73,11 +73,11 @@ class SettingsViewModel: ObservableObject {
init() {
CoreContext.shared.doOnCoreQueue { core in
let enableVfsTmp = CorePreferences.vfsEnabled
let enableVfsTmp = AppServices.corePreferences.vfsEnabled
let adaptiveRateControlTmp = core.adaptiveRateControlEnabled
let enableVideoTmp = core.videoEnabled
let autoRecordTmp = CorePreferences.automaticallyStartCallRecording
let autoRecordTmp = AppServices.corePreferences.automaticallyStartCallRecording
let autoDownloadTmp = core.maxSizeForAutoDownloadIncomingFiles == 0
@ -100,9 +100,9 @@ class SettingsViewModel: ObservableObject {
mediaEncryptionTmp = "DTLS"
}
let mediaEncryptionMandatoryTmp = core.isMediaEncryptionMandatory
let acceptEarlyMediaTmp = CorePreferences.acceptEarlyMedia
let allowOutgoingEarlyMediaTmp = CorePreferences.allowOutgoingEarlyMedia
let deviceIdTmp = CorePreferences.deviceName
let acceptEarlyMediaTmp = AppServices.corePreferences.acceptEarlyMedia
let allowOutgoingEarlyMediaTmp = AppServices.corePreferences.allowOutgoingEarlyMedia
let deviceIdTmp = AppServices.corePreferences.deviceName
let fileSharingServerUrlTmp = core.fileTransferServer
let remoteProvisioningUrlTmp = core.provisioningUri
@ -342,8 +342,8 @@ class SettingsViewModel: ObservableObject {
func saveChangesWhenLeaving() {
CoreContext.shared.doOnCoreQueue { core in
if CorePreferences.vfsEnabled != self.enableVfs {
CorePreferences.vfsEnabled = self.enableVfs
if AppServices.corePreferences.vfsEnabled != self.enableVfs {
AppServices.corePreferences.vfsEnabled = self.enableVfs
}
if core.adaptiveRateControlEnabled != self.adaptiveRateControl {
@ -355,8 +355,8 @@ class SettingsViewModel: ObservableObject {
core.videoDisplayEnabled = self.enableVideo
}
if CorePreferences.automaticallyStartCallRecording != self.autoRecord {
CorePreferences.automaticallyStartCallRecording = self.autoRecord
if AppServices.corePreferences.automaticallyStartCallRecording != self.autoRecord {
AppServices.corePreferences.automaticallyStartCallRecording = self.autoRecord
}
if (core.maxSizeForAutoDownloadIncomingFiles == 0) != self.autoDownload {
@ -402,16 +402,16 @@ class SettingsViewModel: ObservableObject {
core.mediaEncryptionMandatory = self.mediaEncryptionMandatory
}
if CorePreferences.acceptEarlyMedia != self.acceptEarlyMedia {
CorePreferences.acceptEarlyMedia = self.acceptEarlyMedia
if AppServices.corePreferences.acceptEarlyMedia != self.acceptEarlyMedia {
AppServices.corePreferences.acceptEarlyMedia = self.acceptEarlyMedia
}
if CorePreferences.allowOutgoingEarlyMedia != self.allowOutgoingEarlyMedia {
CorePreferences.allowOutgoingEarlyMedia = self.allowOutgoingEarlyMedia
if AppServices.corePreferences.allowOutgoingEarlyMedia != self.allowOutgoingEarlyMedia {
AppServices.corePreferences.allowOutgoingEarlyMedia = self.allowOutgoingEarlyMedia
}
if CorePreferences.deviceName != self.deviceId {
CorePreferences.deviceName = self.deviceId
if AppServices.corePreferences.deviceName != self.deviceId {
AppServices.corePreferences.deviceName = self.deviceId
}
if core.fileTransferServer != self.uploadServerUrl && !(core.fileTransferServer == nil && self.uploadServerUrl.isEmpty) {

View file

@ -239,7 +239,7 @@ class SharedMainViewModel: ObservableObject {
func updateDisableChatFeature() {
CoreContext.shared.doOnCoreQueue { core in
let disableChatFeatureTmp = CorePreferences.disableChatFeature
let disableChatFeatureTmp = AppServices.corePreferences.disableChatFeature
DispatchQueue.main.async {
self.disableChatFeature = disableChatFeatureTmp
@ -249,7 +249,7 @@ class SharedMainViewModel: ObservableObject {
func updateDisableMeetingFeature() {
CoreContext.shared.doOnCoreQueue { core in
let disableMeetingFeatureTmp = CorePreferences.disableMeetings ||
let disableMeetingFeatureTmp = AppServices.corePreferences.disableMeetings ||
!LinphoneUtils.isRemoteConferencingAvailable(core: core)
DispatchQueue.main.async {
self.disableMeetingFeature = disableMeetingFeatureTmp

View file

@ -23,9 +23,6 @@ import linphonesw
// Singleton that manages the Shared Config between app and app extension.
extension Config {
private static var _instance: Config?
public func getDouble(section: String, key: String, defaultValue: Double) -> Double {
if self.hasEntry(section: section, key: key) != 1 {
return defaultValue
@ -33,35 +30,9 @@ extension Config {
let stringValue = self.getString(section: section, key: key, defaultString: "")
return Double(stringValue) ?? defaultValue
}
public static func get() -> Config {
if _instance == nil {
let factoryPath = FileUtil.bundleFilePath("linphonerc-factory")!
_instance = Config.newForSharedCore(appGroupId: Config.appGroupName, configFilename: "linphonerc", factoryConfigFilename: factoryPath)!
let themeMainColor = CorePreferences.themeMainColor
DispatchQueue.main.async {
ThemeManager.shared.applyTheme(named: themeMainColor)
}
}
return _instance!
}
public func getString(section: String, key: String) -> String? {
return hasEntry(section: section, key: key) == 1 ? getString(section: section, key: key, defaultString: "") : nil
}
static let appGroupName = "group.org.linphone.phone.msgNotification"
// Needs to be the same name in App Group (capabilities in ALL targets - app & extensions - content + service), can't be stored in the Config itself the Config needs this value to get created
static let teamID = Config.get().getString(section: "app", key: "team_id", defaultString: "")
static let earlymediaContentExtCatIdentifier = Config.get().getString(section: "app", key: "extension_category", defaultString: "")
// Default values in app
static let serveraddress = Config.get().getString(section: "app", key: "server", defaultString: "")
static let defaultUsername = Config.get().getString(section: "app", key: "user", defaultString: "")
static let defaultPass = Config.get().getString(section: "app", key: "pass", defaultString: "")
static let pushNotificationsInterval = Config.get().getInt(section: "net", key: "pn-call-remote-push-interval", defaultValue: 3)
static let voiceRecordingMaxDuration = Config.get().getInt(section: "app", key: "voice_recording_max_duration", defaultValue: 600000)
}

View file

@ -23,6 +23,8 @@ import UniformTypeIdentifiers
class FileUtil: NSObject {
let appGroupName = "group.org.linphone.phone.msgNotification"
public enum MimeType {
case plainText
case pdf
@ -77,7 +79,7 @@ class FileUtil: NSObject {
}
public class func sharedContainerUrl() -> URL {
return FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: Config.appGroupName)!
return FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.org.linphone.phone.msgNotification")!
}
public class func ensureDirectoryExists(path: String) {

View file

@ -34,10 +34,11 @@ class Log: LoggingServiceDelegate {
var debugEnabled = true // Todo : bind to app parameters
var service = LoggingService.Instance
let appGroupName = "group.org.linphone.phone.msgNotification"
private init() {
service.domain = Bundle.main.bundleIdentifier!
Core.setLogCollectionPath(path: Factory.Instance.getDataDir(context: UnsafeMutablePointer<Int8>(mutating: (Config.appGroupName as NSString).utf8String)))
Core.setLogCollectionPath(path: Factory.Instance.getDataDir(context: UnsafeMutablePointer<Int8>(mutating: (appGroupName as NSString).utf8String)))
Core.enableLogCollection(state: LogCollectionState.Enabled)
setMask()
LoggingService.Instance.addDelegate(delegate: self)

View file

@ -56,11 +56,11 @@ final class MagicSearchSingleton: ObservableObject {
}
private init() {
allContact = CorePreferences.contactsFilter == ""
allContact = AppServices.corePreferences.contactsFilter == ""
coreContext.doOnCoreQueue { core in
self.linphoneDomain = CorePreferences.defaultDomain == core.defaultAccount?.params?.domain
self.domainDefaultAccount = CorePreferences.contactsFilter
self.linphoneDomain = AppServices.corePreferences.defaultDomain == core.defaultAccount?.params?.domain
self.domainDefaultAccount = AppServices.corePreferences.contactsFilter
self.magicSearch = try? core.createMagicSearch()
@ -158,8 +158,8 @@ final class MagicSearchSingleton: ObservableObject {
func changeAllContact(allContactBool: Bool) {
allContact = allContactBool
domainDefaultAccount = allContactBool ? "" : (linphoneDomain ? CorePreferences.defaultDomain : "*")
CorePreferences.contactsFilter = domainDefaultAccount
domainDefaultAccount = allContactBool ? "" : (linphoneDomain ? AppServices.corePreferences.defaultDomain : "*")
AppServices.corePreferences.contactsFilter = domainDefaultAccount
}
func updateContacts(

View file

@ -165,7 +165,7 @@ class URIHandler {
}
private static func autoRemoteProvisioningOnConfigUriHandler() -> Bool {
return Config.get().getBool(section: "app", key: "auto_apply_provisioning_config_uri_handler", defaultValue: true)
return AppServices.config.getBool(section: "app", key: "auto_apply_provisioning_config_uri_handler", defaultValue: true)
}
private static func toast(_ message: String) {

View file

@ -35,7 +35,6 @@
66F08C892C2AFEF700D9AE2F /* MeetingsListBottomSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66F08C882C2AFEF700D9AE2F /* MeetingsListBottomSheet.swift */; };
66F626B22BCEBB86003E2DEC /* AddParticipantsFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66F626B12BCEBB86003E2DEC /* AddParticipantsFragment.swift */; };
66FBFC482B83B8CC00BC6AB1 /* Log.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66C492002B24DB6900CEA16D /* Log.swift */; };
66FBFC492B83BD2400BC6AB1 /* ConfigExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66C491F82B24D25A00CEA16D /* ConfigExtension.swift */; };
66FBFC4A2B83BD3300BC6AB1 /* FileUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66C491FE2B24D4AC00CEA16D /* FileUtils.swift */; };
66FBFC4B2B83BD7B00BC6AB1 /* CoreExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66C491FA2B24D32600CEA16D /* CoreExtension.swift */; };
66FDB7812C7C689A00561566 /* EventEditViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66FDB7802C7C689A00561566 /* EventEditViewController.swift */; };
@ -128,7 +127,6 @@
D74DA0122C047F0700A8561D /* HistoryModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D74DA0112C047F0700A8561D /* HistoryModel.swift */; };
D750D3392AD3E6EE00EC99C5 /* PopupLoadingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D750D3382AD3E6EE00EC99C5 /* PopupLoadingView.swift */; };
D756C8152D34FF9200A58F2F /* SettingsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D756C8142D34FF8900A58F2F /* SettingsViewModel.swift */; };
D756C8172D352C5F00A58F2F /* CorePreferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = D756C8162D352C5600A58F2F /* CorePreferences.swift */; };
D756C8182D352C5F00A58F2F /* CorePreferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = D756C8162D352C5600A58F2F /* CorePreferences.swift */; };
D75759322B56D40900E7AC10 /* ZRTPPopup.swift in Sources */ = {isa = PBXBuildFile; fileRef = D75759312B56D40900E7AC10 /* ZRTPPopup.swift */; };
D759CB642C3FBD4200AC35E8 /* StartConversationFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D759CB632C3FBD4200AC35E8 /* StartConversationFragment.swift */; };
@ -1420,11 +1418,9 @@
files = (
66FBFC482B83B8CC00BC6AB1 /* Log.swift in Sources */,
6691CA7E2B839C2D00B2A7B8 /* NotificationService.swift in Sources */,
66FBFC492B83BD2400BC6AB1 /* ConfigExtension.swift in Sources */,
C642277D2E8E4E2B0094FEDC /* ColorExtension.swift in Sources */,
66FBFC4A2B83BD3300BC6AB1 /* FileUtils.swift in Sources */,
66FBFC4B2B83BD7B00BC6AB1 /* CoreExtension.swift in Sources */,
D756C8172D352C5F00A58F2F /* CorePreferences.swift in Sources */,
C642277C2E8E4D900094FEDC /* ThemeManager.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;

View file

@ -123,7 +123,7 @@
"location" : "https://gitlab.linphone.org/BC/public/linphone-sdk-swift-ios.git",
"state" : {
"branch" : "alpha",
"revision" : "a280d1dc67a2ffd1baceff28186e316b81f187fc"
"revision" : "e2c24740b5f3479ae5d80f0eda11165937c448f8"
}
},
{

View file

@ -26,12 +26,13 @@ import Firebase
#endif
var LINPHONE_DUMMY_SUBJECT = "dummy subject"
let appGroupName = "group.org.linphone.phone.msgNotification"
extension String {
func getDisplayNameFromSipAddress(lc: Core) -> String? {
Log.info("looking for display name for \(self)")
let defaults = UserDefaults.init(suiteName: Config.appGroupName)
let defaults = UserDefaults.init(suiteName: appGroupName)
let addressBook = defaults?.dictionary(forKey: "addressBook")
if addressBook == nil {
@ -87,12 +88,12 @@ class NotificationService: UNNotificationServiceExtension {
bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
LoggingService.Instance.logLevel = LogLevel.Debug
Factory.Instance.logCollectionPath = Factory.Instance.getDataDir(context: UnsafeMutablePointer<Int8>(mutating: (Config.appGroupName as NSString).utf8String))
Factory.Instance.logCollectionPath = Factory.Instance.getDataDir(context: UnsafeMutablePointer<Int8>(mutating: (appGroupName as NSString).utf8String))
Factory.Instance.enableLogCollection(state: LogCollectionState.Enabled)
Log.info("[msgNotificationService] start msgNotificationService extension")
/*
if (VFSUtil.vfsEnabled(groupName: Config.appGroupName) && !VFSUtil.activateVFS()) {
if (VFSUtil.vfsEnabled(groupName: AppServices.config.appGroupName) && !VFSUtil.activateVFS()) {
VFSUtil.log("[VFS] Error unable to activate.", .error)
}
*/
@ -117,7 +118,7 @@ class NotificationService: UNNotificationServiceExtension {
}
/*
let defaults = UserDefaults.init(suiteName: Config.appGroupName)
let defaults = UserDefaults.init(suiteName: AppServices.config.appGroupName)
if let chatroomsPushStatus = defaults?.dictionary(forKey: "chatroomsPushStatus") {
let aps = bestAttemptContent.userInfo["aps"] as? NSDictionary
let alert = aps?["alert"] as? NSDictionary
@ -303,8 +304,11 @@ class NotificationService: UNNotificationServiceExtension {
func createCore() {
Log.info("[msgNotificationService] create core")
let factoryPath = FileUtil.bundleFilePath("linphonerc-factory")!
let config = Config.newForSharedCore(appGroupId: appGroupName, configFilename: "linphonerc", factoryConfigFilename: factoryPath)!
lc = try? Factory.Instance.createSharedCoreWithConfig(config: Config.get(), systemContext: nil, appGroupId: Config.appGroupName, mainCore: false)
lc = try? Factory.Instance.createSharedCoreWithConfig(config: config, systemContext: nil, appGroupId: appGroupName, mainCore: false)
}
func stopCore() {