Configure list of purchasable items in linphonerc
This commit is contained in:
parent
e82385749c
commit
ff64caaa8f
3 changed files with 18 additions and 4 deletions
|
@ -34,3 +34,4 @@ user_certificates_path=/data/data/org.linphone/files
|
||||||
|
|
||||||
[in-app-purchase]
|
[in-app-purchase]
|
||||||
server_url=https://www.linphone.org/inapp.php
|
server_url=https://www.linphone.org/inapp.php
|
||||||
|
purchasable_items_ids=test_account_subscription
|
|
@ -19,6 +19,8 @@ along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.linphone.core.LinphoneAddress;
|
import org.linphone.core.LinphoneAddress;
|
||||||
import org.linphone.core.LinphoneAddress.TransportType;
|
import org.linphone.core.LinphoneAddress.TransportType;
|
||||||
import org.linphone.core.LinphoneAuthInfo;
|
import org.linphone.core.LinphoneAuthInfo;
|
||||||
|
@ -1156,6 +1158,19 @@ public class LinphonePreferences {
|
||||||
return getConfig().getString("in-app-purchase", "server_url", null);
|
return getConfig().getString("in-app-purchase", "server_url", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ArrayList<String> getInAppPurchasables() {
|
||||||
|
ArrayList<String> purchasables = new ArrayList<String>();
|
||||||
|
String list = getConfig().getString("in-app-purchase", "purchasable_items_ids", null);
|
||||||
|
if (list != null) {
|
||||||
|
for(String purchasable : list.split(";")) {
|
||||||
|
if (purchasable.length() > 0) {
|
||||||
|
purchasables.add(purchasable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return purchasables;
|
||||||
|
}
|
||||||
|
|
||||||
public String getDebugPopupAddress(){
|
public String getDebugPopupAddress(){
|
||||||
return getConfig().getString("app", "debug_popup_magic", null);
|
return getConfig().getString("app", "debug_popup_magic", null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,6 @@ import de.timroes.axmlrpc.XMLRPCServerException;
|
||||||
*/
|
*/
|
||||||
public class InAppPurchaseHelper {
|
public class InAppPurchaseHelper {
|
||||||
public static final int API_VERSION = 3;
|
public static final int API_VERSION = 3;
|
||||||
public static final String TEST_ITEM = "test_account_subscription";
|
|
||||||
public static final int ACTIVITY_RESULT_CODE_PURCHASE_ITEM = 11089;
|
public static final int ACTIVITY_RESULT_CODE_PURCHASE_ITEM = 11089;
|
||||||
|
|
||||||
public static final String SKU_DETAILS_ITEM_LIST = "ITEM_ID_LIST";
|
public static final String SKU_DETAILS_ITEM_LIST = "ITEM_ID_LIST";
|
||||||
|
@ -182,8 +181,7 @@ public class InAppPurchaseHelper {
|
||||||
|
|
||||||
private ArrayList<Purchasable> getAvailableItemsForPurchase() {
|
private ArrayList<Purchasable> getAvailableItemsForPurchase() {
|
||||||
ArrayList<Purchasable> products = new ArrayList<Purchasable>();
|
ArrayList<Purchasable> products = new ArrayList<Purchasable>();
|
||||||
ArrayList<String> skuList = new ArrayList<String> ();
|
ArrayList<String> skuList = LinphonePreferences.instance().getInAppPurchasables();
|
||||||
skuList.add(TEST_ITEM);
|
|
||||||
Bundle querySkus = new Bundle();
|
Bundle querySkus = new Bundle();
|
||||||
querySkus.putStringArrayList(SKU_DETAILS_ITEM_LIST, skuList);
|
querySkus.putStringArrayList(SKU_DETAILS_ITEM_LIST, skuList);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue