mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-27 07:59:20 +00:00
Merge branch 'master' into tunnel
This commit is contained in:
commit
dd2a4c31c2
3 changed files with 40 additions and 31 deletions
|
|
@ -43,17 +43,17 @@
|
|||
[[LinphoneManager instance] becomeActive];
|
||||
}
|
||||
|
||||
- (void)registerDefaultsFromSettingsBundle {
|
||||
// source: http://stackoverflow.com/questions/510216/
|
||||
- (void) loadDefaultSettings {
|
||||
|
||||
NSString *settingsBundle = [[NSBundle mainBundle] pathForResource:@"Settings" ofType:@"bundle"];
|
||||
if(!settingsBundle) {
|
||||
NSLog(@"Could not find Settings.bundle");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
NSDictionary *settings = [NSDictionary dictionaryWithContentsOfFile:[settingsBundle stringByAppendingPathComponent:@"Root.plist"]];
|
||||
NSArray *preferences = [settings objectForKey:@"PreferenceSpecifiers"];
|
||||
|
||||
|
||||
NSMutableDictionary *defaultsToRegister = [[NSMutableDictionary alloc] initWithCapacity:[preferences count]];
|
||||
for(NSDictionary *prefSpecification in preferences) {
|
||||
NSString *key = [prefSpecification objectForKey:@"Key"];
|
||||
|
|
@ -61,26 +61,15 @@
|
|||
[defaultsToRegister setObject:[prefSpecification objectForKey:@"DefaultValue"] forKey:key];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"NO", @"enable_first_login_view_preference", //
|
||||
nil];
|
||||
|
||||
[defaultsToRegister addEntriesFromDictionary:appDefaults];
|
||||
[[NSUserDefaults standardUserDefaults] registerDefaults:defaultsToRegister];
|
||||
[defaultsToRegister release];
|
||||
}
|
||||
|
||||
- (void) loadDefaultSettings {
|
||||
|
||||
// if this is the first launch after installing, we would like to load default settings values from Settings.bundle
|
||||
NSObject *somePrefVal = [[NSUserDefaults standardUserDefaults] objectForKey:@"debugenable_preference"];
|
||||
if(!somePrefVal) {
|
||||
// has no value, so defaults have not been loaded yet
|
||||
[self registerDefaultsFromSettingsBundle];
|
||||
}
|
||||
|
||||
NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"NO", @"enable_first_login_view_preference", //
|
||||
nil];
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
|
||||
}
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
|
||||
|
|
|
|||
|
|
@ -393,8 +393,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach
|
|||
proxyReachability=SCNetworkReachabilityCreateWithName(nil, linphone_address_get_domain(addr));
|
||||
|
||||
} else {
|
||||
if (configCheckDisable == false
|
||||
&& (!domain && !username)) {
|
||||
if (configCheckDisable == false ) {
|
||||
UIAlertView* error = [[UIAlertView alloc] initWithTitle:@"Warning"
|
||||
message:@"It seems you have not configured any proxy server from settings"
|
||||
delegate:self
|
||||
|
|
|
|||
|
|
@ -19,9 +19,27 @@
|
|||
|
||||
#import "UISpeakerButton.h"
|
||||
#import <AudioToolbox/AudioToolbox.h>
|
||||
#include "linphonecore.h"
|
||||
|
||||
@implementation UISpeakerButton
|
||||
|
||||
static void audioRouteChangeListenerCallback (
|
||||
void *inUserData, // 1
|
||||
AudioSessionPropertyID inPropertyID, // 2
|
||||
UInt32 inPropertyValueSize, // 3
|
||||
const void *inPropertyValue // 4
|
||||
) {
|
||||
if (inPropertyID != kAudioSessionProperty_AudioRouteChange) return; // 5
|
||||
[(UISpeakerButton*)inUserData reset];
|
||||
|
||||
}
|
||||
|
||||
-(void) initWithOnImage:(UIImage*) onImage offImage:(UIImage*) offImage {
|
||||
[super initWithOnImage:onImage offImage:offImage];
|
||||
AudioSessionPropertyID routeChangeID = kAudioSessionProperty_AudioRouteChange;
|
||||
AudioSessionAddPropertyListener(routeChangeID, audioRouteChangeListenerCallback, self);
|
||||
}
|
||||
|
||||
|
||||
-(void) onOn {
|
||||
//redirect audio to speaker
|
||||
|
|
@ -38,13 +56,16 @@
|
|||
, &audioRouteOverride);
|
||||
}
|
||||
-(bool) isInitialStateOn {
|
||||
UInt32 audioRouteOverride;
|
||||
UInt32 size = sizeof (audioRouteOverride);
|
||||
AudioSessionGetProperty (kAudioSessionProperty_OverrideAudioRoute
|
||||
, &size
|
||||
, (void*)(&audioRouteOverride));
|
||||
return kAudioSessionOverrideAudioRoute_Speaker == audioRouteOverride;
|
||||
|
||||
CFStringRef lNewRoute=CFSTR("Unknown");
|
||||
UInt32 lNewRouteSize = sizeof(lNewRoute);
|
||||
OSStatus lStatus = AudioSessionGetProperty(kAudioSessionProperty_AudioRoute
|
||||
,&lNewRouteSize
|
||||
,&lNewRoute);
|
||||
if (!lStatus && CFStringGetLength(lNewRoute) > 0) {
|
||||
ms_message("Current audio route is [%s]",CFStringGetCStringPtr(lNewRoute, kCFStringEncodingUTF8));
|
||||
return (kCFCompareEqualTo == CFStringCompare (lNewRoute,CFSTR("Speaker"),0));
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue