◎위챗 : speedseoul
SettingsView.m
[settingsStore synchronize]; 셋팅값을가져와서 코아값을 set
[self recomputeAccountLabelsAndSync]; //동기화
- (void)viewDidLoad {
[super viewDidLoad];
settingsStore = [[LinphoneCoreSettingsStore alloc] init]; //린폰코아 세팅스토어 크래스복제
_settingsController.showDoneButton = FALSE;
_settingsController.delegate = self;
_settingsController.showCreditsFooter = FALSE;
_settingsController.settingsStore = settingsStore;
[_navigationController.view setBackgroundColor:[UIColor clearColor]];
_navigationController.view.frame = self.subView.frame;
[_navigationController pushViewController:_settingsController animated:FALSE];
[self.view addSubview:_navigationController.view];
}
뷰열면서 바로시작
- (void)settingsViewControllerWillAppear:(IASKAppSettingsViewController *)sender {
isRoot = (sender.file == nil || [sender.file isEqualToString:@"Root"]);
_titleLabel.text = sender.title;
// going to account: fill account specific info
if ([sender.file isEqualToString:@"Account"]) {
LOGI(@"Going editing account %@", sender.title);
[settingsStore transformAccountToKeys:sender.title]; //어카운트이면 어카운트셋팅값만 새로셋팅
} else if ([sender.file isEqualToString:@"Contacts"]) {
[settingsStore synchronize];
[self recomputeLdapLabelsAndSync];
} else if ([sender.file isEqualToString:@"LDAP"]) {
LOGI(@"Going editing LDAP config %@", sender.title);
[settingsStore transformLdapToKeys:sender.title];
} else if ([sender.file isEqualToString:@"Root"]) { // coming back to default: if we were in account, we must synchronize account now
[settingsStore synchronize]; //루트이면 공통값과 어카운트 설정값을가져온다
[self recomputeAccountLabelsAndSync];
}
}
각각의 어카운트 설정값을 리로드한다
- (void)recomputeAccountLabelsAndSync {
// it's a bit violent... but IASK is not designed to dynamically change subviews' name
_settingsController.hiddenKeys = [self findHiddenKeys];
[_settingsController.settingsReader indexPathForKey:@"menu_account_1"]; // force refresh username'
[_settingsController.settingsReader indexPathForKey:@"menu_account_2"]; // force refresh username'
[_settingsController.settingsReader indexPathForKey:@"menu_account_3"]; // force refresh username'
[_settingsController.settingsReader indexPathForKey:@"menu_account_4"]; // force refresh username'
[_settingsController.settingsReader indexPathForKey:@"menu_account_5"]; // force refresh username'
[[_settingsController tableView] reloadData];
}
- (IASKSettingsReader *)settingsReader {
IASKSettingsReader *r = [super settingsReader];
NSMutableArray *dataSource = [NSMutableArray arrayWithArray:[r dataSource]];
if ([[UIApplication sharedApplication] applicationState] != UIApplicationStateBackground) {
for (int i = 0; i < [dataSource count]; ++i) {
NSMutableArray *specifiers = [NSMutableArray arrayWithArray:[dataSource objectAtIndex:i]];
for (int j = 0; j < [specifiers count]; ++j) {
id sp = [specifiers objectAtIndex:j];
if ([sp isKindOfClass:[IASKSpecifier class]]) {
sp = [SettingsView filterSpecifier:sp];
}
[specifiers replaceObjectAtIndex:j withObject:sp];
}
[dataSource replaceObjectAtIndex:i withObject:specifiers];
}
} else {
NSLog(@"Application is in background, linphonecore is off, skiping filter specifier.");
}
[r setDataSource:dataSource];
return r;
}
////////////////////////////////////////////////////////////////////
#import "IASKSettingsReader.h"
#import "IASKSpecifier.h"
@interface IASKSettingsReader (private)
- (void)_reinterpretBundle:(NSDictionary*)settingsBundle;
- (BOOL)_sectionHasHeading:(NSInteger)section;
- (NSString *)platformSuffix;
- (NSString *)locateSettingsFile:(NSString *)file;
@end
@implementation IASKSettingsReader
@synthesize path=_path,
localizationTable=_localizationTable,
bundlePath=_bundlePath,
settingsBundle=_settingsBundle,
dataSource=_dataSource,
hiddenKeys = _hiddenKeys;
- (id)init {
return [self initWithFile:@"Root"];
}
- (id)initWithFile:(NSString*)file {
if ((self=[super init])) {
self.path = [self locateSettingsFile: file];
[self setSettingsBundle:[NSDictionary dictionaryWithContentsOfFile:self.path]];
self.bundlePath = [self.path stringByDeletingLastPathComponent];
_bundle = [NSBundle bundleWithPath:[self bundlePath]];
// Look for localization file
self.localizationTable = [self.settingsBundle objectForKey:@"StringsTable"];
if (!self.localizationTable)
{