diff --git a/appinfo/routes.php b/appinfo/routes.php index da18e0f..c1f9157 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -15,18 +15,20 @@ $application = new OcSmsApp(); $application->registerRoutes($this, array('routes' => array( array('name' => 'sms#index', 'url' => '/', 'verb' => 'GET'), - array('name' => 'sms#retrieve_all_peers', 'url' => '/get/peerlist', 'verb' => 'GET'), - array('name' => 'sms#get_conversation', 'url' => '/get/conversation', 'verb' => 'GET'), array('name' => 'sms#delete_conversation', 'url' => '/delete/conversation', 'verb' => 'POST'), - array('name' => 'sms#check_new_messages', 'url' => '/get/new_messages', 'verb' => 'GET'), array('name' => 'sms#delete_message', 'url' => '/delete/message', 'verb' => 'POST'), array('name' => 'settings#set_country', 'url'=> '/set/country', 'verb' => 'POST'), - array('name' => 'settings#get_settings', 'url'=> '/get/settings', 'verb' => 'GET'), array('name' => 'settings#set_messagelimit', 'url'=> '/set/msglimit', 'verb' => 'POST'), array('name' => 'settings#set_notification_state', 'url'=> '/set/notification_state', 'verb' => 'POST'), array('name' => 'settings#set_contact_order', 'url' => '/set/contact_order', 'verb' => 'POST'), + // Front API + array('name' => 'sms#retrieve_all_peers', 'url' => '/front-api/v1/peerlist', 'verb' => 'GET'), + array('name' => 'sms#get_conversation', 'url' => '/front-api/v1/conversation', 'verb' => 'GET'), + array('name' => 'sms#check_new_messages', 'url' => '/front-api/v1/new_messages', 'verb' => 'GET'), + array('name' => 'settings#get_settings', 'url'=> '/front-api/v1/settings', 'verb' => 'GET'), + // Android API v1 doesn't have a version in the URL, be careful array('name' => 'api#get_api_version', 'url' => '/get/apiversion', 'verb' => 'GET'), // Android APIv1 array('name' => 'api#push', 'url' => '/push', 'verb' => 'POST'), // Android API @@ -34,12 +36,15 @@ $application->registerRoutes($this, array('routes' => array( array('name' => 'api#retrieve_all_ids', 'url' => '/get/smsidlist', 'verb' => 'GET'), // Android APIv1 array('name' => 'api#retrieve_last_timestamp', 'url' => '/get/lastmsgtime', 'verb' => 'GET'), // Android APIv1 - // API v2 + // Android API v2 array('name' => 'api#get_all_stored_phone_numbers', 'url' => '/api/v2/phones/list', 'verb' => 'GET'), // Android APIv2 array('name' => 'api#fetch_messages', 'url' => '/api/v2/messages/{start}/{limit}', 'verb' => 'GET'), // Android APIv2 array('name' => 'api#fetch_messages_count', 'url' => '/api/v2/messages/count', 'verb' => 'GET'), // Android APIv2 - // API v3 + // Android API v3 + // @TODO + + // Android API v4 // @TODO future calls to sending calls recorded on the phone - array('name' => 'api#fetch_messages_to_send', 'url' => '/api/v3/messages/sendqueue', 'verb' => 'GET'), // Android APIv3 + array('name' => 'api#fetch_messages_to_send', 'url' => '/api/v4/messages/sendqueue', 'verb' => 'GET'), // Android APIv3 ))); diff --git a/js/public/app.js b/js/public/app.js index 56e3949..2246300 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -154,7 +154,7 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile' $scope.messages = []; $scope.lastConvMessageDate = 0; - $.getJSON(OC.generateUrl('/apps/ocsms/get/conversation'), {'phoneNumber': $scope.selectedContact.nav}, + $.getJSON(OC.generateUrl('/apps/ocsms/front-api/v1/conversation'), {'phoneNumber': $scope.selectedContact.nav}, function(jsondata, status) { var phoneNumberLabel = $scope.selectedContact.nav; @@ -185,7 +185,7 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile' ); }; $scope.refreshConversation = function() { - $.getJSON(OC.generateUrl('/apps/ocsms/get/conversation'), + $.getJSON(OC.generateUrl('/apps/ocsms/front-api/v1/conversation'), { 'phoneNumber': $scope.selectedContact.nav, "lastDate": $scope.lastConvMessageDate @@ -210,7 +210,7 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile' }; $scope.checkNewMessages = function() { g_unreadCountAllConv = 0; - $.getJSON(OC.generateUrl('/apps/ocsms/get/new_messages'), + $.getJSON(OC.generateUrl('/apps/ocsms/front-api/v1/new_messages'), { 'lastDate': $scope.lastContactListMsgDate }, function(jsondata, status) { var bufferedContacts = []; @@ -367,7 +367,7 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile' }; $scope.fetchInitialSettings = function () { - $.getJSON(OC.generateUrl('/apps/ocsms/get/settings'), function(jsondata, status) { + $.getJSON(OC.generateUrl('/apps/ocsms/front-api/v1/settings'), function(jsondata, status) { if (jsondata['status'] == true) { $('#sel_intl_phone').val(jsondata["country"]); @@ -506,7 +506,7 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile' g_originalTitle = document.title; // Now bind the events when we click on the phone number - $.getJSON(OC.generateUrl('/apps/ocsms/get/peerlist'), function(jsondata, status) { + $.getJSON(OC.generateUrl('/apps/ocsms/front-api/v1/peerlist'), function(jsondata, status) { $scope.fetchInitialPeerList(jsondata); var pnParam = $.urlParam('phonenumber');