platform/iphone/Classes/Server/ServerHost.m in rhodes-1.5.1 vs platform/iphone/Classes/Server/ServerHost.m in rhodes-1.5.2

- old
+ new

@@ -76,11 +76,11 @@ @implementation ServerHost @synthesize actionTarget, /*onStartFailure,*/ onStartSuccess, onRefreshView, onNavigateTo, onExecuteJs; @synthesize /*onSetViewHomeUrl, onSetViewOptionsUrl,*/ onTakePicture, onChoosePicture, onChooseDateTime; @synthesize onCreateNativeBar, onRemoveNativeBar, onSwitchTab; -@synthesize onShowPopup, onVibrate, onPlayFile, onSysCall, onMapLocation, onCreateMap, onActiveTab, onShowLog; +@synthesize onShowPopup, onVibrate, onPlayFile, onStopPlaying, onSysCall, onMapLocation, onCreateMap, onActiveTab, onShowLog; - (void)serverStarted:(NSString*)data { if(actionTarget && [actionTarget respondsToSelector:onStartSuccess]) { [actionTarget performSelector:onStartSuccess withObject:data]; } @@ -201,10 +201,16 @@ if(actionTarget && [actionTarget respondsToSelector:onPlayFile]) { [actionTarget performSelectorOnMainThread:onPlayFile withObject:fileName waitUntilDone:NO]; } } +- (void)stopPlaying { + if (actionTarget && [actionTarget respondsToSelector:onStopPlaying]) { + [actionTarget performSelectorOnMainThread:onStopPlaying withObject:nil waitUntilDone:NO]; + } +} + - (void)mapLocation:(NSString*) query { if(actionTarget && [actionTarget respondsToSelector:onMapLocation]) { [actionTarget performSelectorOnMainThread:onMapLocation withObject:query waitUntilDone:NO]; } } @@ -448,15 +454,10 @@ void webview_set_menu_items(VALUE valMenu) { //TODO: webview_set_menu_items rho_rhodesapp_setViewMenu(valMenu); } -void Init_RingtoneManager() -{ - //TODO: implement Ringtone -} - void alert_show_popup(char* message) { if (message==NULL) { RAWLOG_ERROR("Alert.show_popup - wrong arguments"); } else { [[ServerHost sharedInstance] showPopup:[NSString stringWithUTF8String:message]]; @@ -472,9 +473,31 @@ RAWLOG_ERROR("Alert.play_file - please specify file name to play"); } else { [[ServerHost sharedInstance] playFile:[NSString stringWithUTF8String:file_name] mediaType:media_type?[NSString stringWithUTF8String:media_type]:NULL]; } +} + +VALUE rho_ringtone_manager_get_all() +{ + // No API to get ringtones + return rho_ruby_get_NIL(); +} + +void rho_ringtone_manager_play(char *file_name) +{ + if (file_name == NULL) { + RAWLOG_ERROR("RingtoneManager.play - please specify file name to play"); + return; + } + + [[ServerHost sharedInstance] playFile:[NSString stringWithUTF8String:file_name] + mediaType:NULL]; +} + +void rho_ringtone_manager_stop() +{ + [[ServerHost sharedInstance] stopPlaying]; } void take_picture(char* callback_url) { [[ServerHost sharedInstance] takePicture:[NSString stringWithUTF8String:callback_url]]; } \ No newline at end of file