inapp: terminate shop

This commit is contained in:
Gautier Pelloux-Prayer 2016-08-31 10:45:55 +02:00
parent 0ce8512a9a
commit 76d99fa43b
13 changed files with 107 additions and 109 deletions

View file

@ -55,7 +55,10 @@
linphone_account_creator_set_username(
account_creator, linphone_address_get_username(linphone_proxy_config_get_identity_address(cfg)));
const LinphoneAuthInfo *info = linphone_proxy_config_find_auth_info(cfg);
linphone_account_creator_set_password(account_creator, linphone_auth_info_get_passwd(info));
if (linphone_auth_info_get_passwd(info))
linphone_account_creator_set_password(account_creator, linphone_auth_info_get_passwd(info));
else
linphone_account_creator_set_ha1(account_creator, linphone_auth_info_get_ha1(info));
linphone_account_creator_set_domain(account_creator, linphone_proxy_config_get_domain(cfg));
} else {
LOGW(@"Default proxy is NOT a sip.linphone.org, aborting");

View file

@ -946,7 +946,8 @@ void assistant_is_account_activated(LinphoneAccountCreator *creator, LinphoneAcc
ONCLICKBUTTON(sender, 100, {
_waitView.hidden = NO;
linphone_account_creator_set_activation_code(account_creator, ((UITextField*)[self findView:ViewElement_SMSCode inView:_contentView ofType:UITextField.class]).text.UTF8String);
if (linphone_account_creator_get_password(account_creator) == NULL) {
if (linphone_account_creator_get_password(account_creator) == NULL &&
linphone_account_creator_get_ha1(account_creator) == NULL) {
linphone_account_creator_activate_account(account_creator);
} else {
linphone_account_creator_activate_phone_number_link(account_creator);
@ -973,7 +974,8 @@ void assistant_is_account_activated(LinphoneAccountCreator *creator, LinphoneAcc
_waitView.hidden = NO;
if ((linphone_account_creator_get_phone_number(account_creator) != NULL) &&
linphone_account_creator_get_password(account_creator) == NULL) {
linphone_account_creator_get_password(account_creator) == NULL &&
linphone_account_creator_get_ha1(account_creator) == NULL) {
linphone_account_creator_recover_phone_account(account_creator);
} else {
// check if account is already linked with a phone number.

View file

@ -1,41 +1,41 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11198.2" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" colorMatched="YES">
<dependencies>
<deployment identifier="iOS"/>
<development version="7000" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ShopView">
<connections>
<outlet property="portraitView" destination="HJH-1o-RXN" id="Hoa-uk-q9s"/>
<outlet property="view" destination="HJH-1o-RXN" id="OKD-FI-yhX"/>
<outlet property="tableViewController" destination="sBe-ML-IzT" id="8zr-PW-7c4"/>
<outlet property="view" destination="HJH-1o-RXN" id="AhB-ik-484"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="eP3-Qs-BZl" userLabel="iphone6MetricsView">
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view tag="1" contentMode="scaleToFill" id="HJH-1o-RXN">
<rect key="frame" x="0.0" y="66" width="320" height="414"/>
<frame key="frameInset" minY="66"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view tag="2" contentMode="scaleToFill" id="Whz-oo-Pwx" userLabel="topBar">
<rect key="frame" x="0.0" y="0.0" width="320" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<frame key="frameInset" height="66"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" tag="3" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="color_F.png" id="h54-RV-eE6" userLabel="backgroundColor">
<rect key="frame" x="0.0" y="0.0" width="320" height="66"/>
<frame key="frameInset" height="100.00%"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" flexibleMaxY="YES"/>
</imageView>
<button opaque="NO" tag="4" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="ETk-tB-ZNl" userLabel="dialerBackButton" customClass="UIIconButton">
<rect key="frame" x="255" y="0.0" width="65" height="66"/>
<frame key="frameInset" minY="0.0%" width="20.80%" height="100.00%"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Add contact"/>
<inset key="titleEdgeInsets" minX="0.0" minY="18" maxX="0.0" maxY="0.0"/>
<state key="normal" image="dialer_back_default.png">
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="disabled" image="dialer_back_disabled.png"/>
<state key="highlighted" backgroundImage="color_E.png"/>
@ -44,36 +44,37 @@
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" tag="5" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="SHOP" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="iNt-9d-7si" userLabel="titleLabel">
<rect key="frame" x="0.0" y="0.0" width="320" height="66"/>
<frame key="frameInset" minX="0.0%" minY="0.0%" width="100.00%" height="100.00%"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="27"/>
<color key="textColor" red="0.98766469955444336" green="0.27512490749359131" blue="0.029739789664745331" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.98766469955444336" green="0.27512490749359131" blue="0.029739789664745331" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</view>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="AXe-My-OHb" customClass="ShowTableView">
<rect key="frame" x="0.0" y="66" width="320" height="348"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<tableView clipsSubviews="YES" contentMode="scaleToFill" misplaced="YES" bounces="NO" style="plain" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="cnd-cB-B4W">
<frame key="frameInset" minY="66"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<connections>
<outlet property="dataSource" destination="Pl4-ib-dZC" id="Cny-je-KR9"/>
<outlet property="delegate" destination="Pl4-ib-dZC" id="kzc-F5-3JS"/>
<outlet property="dataSource" destination="sBe-ML-IzT" id="EPO-Za-dkU"/>
<outlet property="delegate" destination="sBe-ML-IzT" id="T0H-aj-0UQ"/>
</connections>
</tableView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<point key="canvasLocation" x="235" y="318"/>
<color key="backgroundColor" red="1" green="1" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<point key="canvasLocation" x="-414.5" y="-738.5"/>
</view>
<tapGestureRecognizer id="l7c-wq-pii" userLabel="onLinkTap">
<tableViewController id="sBe-ML-IzT" customClass="ShopTableView">
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics"/>
<connections>
<action selector="onLinkTap:" destination="-1" id="Ay5-Uz-RDo"/>
<outlet property="view" destination="cnd-cB-B4W" id="hcK-9Y-fd5"/>
</connections>
</tapGestureRecognizer>
<tableViewController id="Pl4-ib-dZC"/>
<point key="canvasLocation" x="34" y="-724"/>
</tableViewController>
</objects>
<resources>
<image name="color_E.png" width="2" height="2"/>
@ -84,6 +85,6 @@
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination"/>
<simulatedScreenMetrics key="destination" type="retina4_7.fullscreen"/>
</simulatedMetricsContainer>
</document>

View file

@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11198.2" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" colorMatched="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="SideMenuView">
@ -29,45 +30,45 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="42" width="375" height="625"/>
<frame key="frameInset" minY="42"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view hidden="YES" alpha="0.69999999999999996" contentMode="scaleToFill" id="ccB-VK-LF9">
<rect key="frame" x="0.0" y="0.0" width="375" height="625"/>
<frame key="frameInset"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<connections>
<outletCollection property="gestureRecognizers" destination="56h-cQ-B5V" appends="YES" id="umX-R7-2IR"/>
</connections>
</view>
<view contentMode="scaleToFill" id="i1P-cG-q8h" userLabel="headerView">
<rect key="frame" x="0.0" y="0.0" width="300" height="100"/>
<frame key="frameInset" width="300" height="100"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<imageView contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="color_F.png" id="90B-Re-hmt" userLabel="backgroundColor">
<rect key="frame" x="0.0" y="0.0" width="300" height="100"/>
<frame key="frameInset" height="100.00%"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" flexibleMaxY="YES"/>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="John Doe" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="19" id="XbU-2B-u1b" userLabel="nameLabel">
<rect key="frame" x="76" y="15" width="224" height="31"/>
<frame key="frameInset" minX="76" minY="15" width="100.00%" height="31"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="25"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="john.doe@sip.linphone.org" lineBreakMode="middleTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" id="V8A-tK-4iV" userLabel="addressLabel">
<rect key="frame" x="76" y="54" width="208" height="38"/>
<frame key="frameInset" minX="76" minY="54" width="92.86%" height="38"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="1" green="0.36862745099999999" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="textColor" red="0.98766469955444336" green="0.27512490749359131" blue="0.029739789664745331" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="led_connected.png" id="C88-Ag-nm7" userLabel="presenceImage">
<rect key="frame" x="284" y="58" width="16" height="29"/>
<frame key="frameInset" minY="58" width="16" height="29"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
</imageView>
<imageView contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="avatar.png" id="BNQ-7N-NGT" userLabel="avatarImage" customClass="UIRoundedImageView">
<rect key="frame" x="3" y="15" width="68" height="77"/>
<frame key="frameInset" minX="3" minY="15" width="68" height="77"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<connections>
<outletCollection property="gestureRecognizers" destination="Kej-uL-ntg" appends="YES" id="eog-XV-xok"/>
@ -80,29 +81,27 @@
</connections>
</view>
<tableView clipsSubviews="YES" contentMode="scaleToFill" bounces="NO" style="plain" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="Ttt-1k-jAm">
<rect key="frame" x="0.0" y="100" width="300" height="525"/>
<frame key="frameInset" minY="100" width="300" height="100.00%"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" heightSizable="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<connections>
<outlet property="dataSource" destination="Yyh-z6-IGO" id="ytx-b8-NGX"/>
<outlet property="delegate" destination="Yyh-z6-IGO" id="c1j-vG-TbB"/>
</connections>
</tableView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<gestureRecognizers/>
<connections>
<outletCollection property="gestureRecognizers" destination="JRs-i1-zCl" appends="YES" id="SPs-Nb-Y0e"/>
</connections>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina47"/>
<color key="backgroundColor" red="1" green="1" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<point key="canvasLocation" x="322.5" y="209.5"/>
</view>
<tableViewController id="Yyh-z6-IGO" customClass="SideMenuTableView">
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics"/>
<simulatedOrientationMetrics key="simulatedOrientationMetrics"/>
<connections>
<outlet property="view" destination="Ttt-1k-jAm" id="Njc-lf-vXv"/>
</connections>
@ -125,8 +124,13 @@
</tapGestureRecognizer>
</objects>
<resources>
<image name="avatar.png" width="255" height="255"/>
<image name="avatar.png" width="259" height="259"/>
<image name="color_F.png" width="2" height="2"/>
<image name="led_connected.png" width="11" height="11"/>
<image name="led_connected.png" width="12" height="12"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4_7.fullscreen"/>
</simulatedMetricsContainer>
</document>

View file

@ -58,7 +58,7 @@
checkPeriod = [LinphoneManager.instance lpConfigIntForKey:@"expiry_check_period" inSection:@"in_app_purchase"];
warnBeforeExpiryPeriod = [LinphoneManager.instance lpConfigIntForKey:@"warn_before_expiry_period" inSection:@"in_app_purchase"];
lastCheck = 0;
int testExpiry = [LinphoneManager.instance lpConfigIntForKey:@"expiry_time_test" inSection:@"in_app_purchase"];
if (testExpiry > 0){
expiryTime = time(NULL) + testExpiry;
@ -284,7 +284,7 @@
// if ([transaction.transactionIdentifier
// isEqualToString:transaction.originalTransaction.transactionIdentifier]) {
if (self.accountCreationData.count == 3) {
[request setMethod:@"create_account_from_in_app_purchase"
[request setMethod:@"update_expiration_date"
withParameters:[NSArray arrayWithObjects:@"", [_accountCreationData objectForKey:@"phoneNumber"],
receiptBase64, @"", @"apple",
[_accountCreationData objectForKey:@"email"], nil]];
@ -292,7 +292,7 @@
// otherwise simply renewing
} else {
if ([[self getPhoneNumber] length] > 0) {
[request setMethod:@"get_expiration_date"
[request setMethod:@"update_expiration_date"
withParameters:[NSArray
arrayWithObjects:[self getPhoneNumber], receiptBase64, @"", @"apple", nil]];
} else {
@ -404,7 +404,7 @@
// validation succeeded
if (![response isFault] && [response object] != nil) {
if (([[request method] isEqualToString:@"get_expiration_date"]) ||
if (([[request method] isEqualToString:@"get_account_expiration"]) ||
([[request method] isEqualToString:@"create_account_from_in_app_purchase"])) {
[_productsIDPurchased removeObject:productID];
// response object can either be expiration date (long long number or an error string)
@ -501,30 +501,30 @@
if ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground){
UILocalNotification *notification = [[UILocalNotification alloc] init];
if (notification) {
notification.category = notificationCategory;
notification.repeatInterval = 0;
notification.applicationIconBadgeNumber = 1;
notification.alertBody = expireText;
[[UIApplication sharedApplication] presentLocalNotificationNow:notification];
}
}else{
UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"Account expiring"
message:expireText
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* buyAction = [UIAlertAction actionWithTitle:@"Buy" style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
[PhoneMainView.instance changeCurrentView:ShopView.compositeViewDescription];
}];
UIAlertAction* laterAction = [UIAlertAction actionWithTitle:@"Later" style:UIAlertActionStyleCancel
handler:^(UIAlertAction * action) {
// [alert dismissViewControllerAnimated:FALSE];
}];
[alert addAction:buyAction];
[alert addAction:laterAction];
[PhoneMainView.instance presentViewController:alert animated:YES completion:nil];
@ -534,7 +534,7 @@
- (void) check{
if (!_available) return;
if (expiryTime == 0 || checkPeriod == 0) return;
time_t now = time(NULL);
if (now < lastCheck + checkPeriod) return;

View file

@ -21,9 +21,26 @@
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [[UITableViewCell alloc] init];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass(self.class)];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:NSStringFromClass(self.class)];
}
SKProduct *product = LinphoneManager.instance.iapManager.productsAvailable[indexPath.row];
cell.textLabel.text = LinphoneManager.instance.iapManager.productsAvailable[indexPath.row];
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
[numberFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
[numberFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
[numberFormatter setLocale:product.priceLocale];
NSString *price = [numberFormatter stringFromNumber:product.price];
cell.textLabel.text = [NSString stringWithFormat:@"%@ (%@)", product.localizedTitle, price];
cell.detailTextLabel.text = product.localizedDescription;
cell.detailTextLabel.numberOfLines = 2;
cell.detailTextLabel.minimumScaleFactor = .5;
cell.detailTextLabel.adjustsFontSizeToFitWidth = cell.detailTextLabel.adjustsLetterSpacingToFitWidth = YES;
cell.accessoryType = UITableViewCellAccessoryDetailButton;
[cell setImage:[UIImage imageNamed:@"linphone_logo"]];
return cell;
}
@ -31,8 +48,8 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:NO];
UITableViewCell *cell = [self tableView:tableView cellForRowAtIndexPath:indexPath];
[LinphoneManager.instance.iapManager purchaseWithID:cell.textLabel.text];
SKProduct *product = LinphoneManager.instance.iapManager.productsAvailable[indexPath.row];
[LinphoneManager.instance.iapManager purchaseWithID:product.productIdentifier];
}
@end

View file

@ -19,17 +19,12 @@
#import <UIKit/UIKit.h>
#import "ShopTableView.h"
#import "UICompositeView.h"
@interface ShopView : TPMultiLayoutViewController <UICompositeViewDelegate>
@interface ShopView : UIViewController <UICompositeViewDelegate>
@property(weak, nonatomic) IBOutlet UILabel *accountProductTitle;
@property(weak, nonatomic) IBOutlet UILabel *accountProductDescription;
@property(weak, nonatomic) IBOutlet UILabel *accountProductPrice;
@property(weak, nonatomic) IBOutlet UIButton *accountBuyButton;
- (IBAction)onLinkTap:(id)sender;
@property(strong, nonatomic) IBOutlet ShopTableView *tableViewController;
- (IBAction)onDialerBackClick:(id)sender;
- (IBAction)onPurchaseButtonClick:(id)sender;
@end

View file

@ -45,38 +45,14 @@ static UICompositeViewDescription *compositeDescription = nil;
return self.class.compositeViewDescription;
}
#pragma mark - ViewController Functions
- (void)viewDidLoad {
InAppProductsManager *aipm = LinphoneManager.instance.iapManager;
NSMutableArray *productsAvailable = aipm.productsAvailable;
if ( [productsAvailable count] > 0){
SKProduct *product = [productsAvailable objectAtIndex:0];
[_accountProductTitle setText:product.localizedTitle];
[_accountProductDescription setText:product.localizedDescription];
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
[numberFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
[numberFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
[numberFormatter setLocale:product.priceLocale];
NSString *formattedString = [numberFormatter stringFromNumber:product.price];
[_accountProductPrice setText:formattedString];
}
[super viewDidLoad];
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[_tableViewController.tableView reloadData];
}
#pragma mark - Action Functions
- (IBAction)onLinkTap:(id)sender {
}
- (IBAction)onDialerBackClick:(id)sender {
[PhoneMainView.instance popToView:DialerView.compositeViewDescription];
}
- (IBAction)onPurchaseButtonClick:(id)sender {
[PhoneMainView.instance popToView:DialerView.compositeViewDescription];
}
@end

View file

@ -34,10 +34,10 @@
// remove separators between empty items, cf
// http://stackoverflow.com/questions/1633966/can-i-force-a-uitableview-to-hide-the-separator-between-empty-cells
self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
}
//}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
//- (void)viewWillAppear:(BOOL)animated {
// [super viewWillAppear:animated];
_sideMenuEntries = [[NSMutableArray alloc] init];

View file

@ -28,6 +28,6 @@
<entry name="username_max_length" overwrite="true">64</entry>
<entry name="username_min_length" overwrite="true">1</entry>
<entry name="username_regex" overwrite="true">^[a-z0-9+_.\-]*$</entry>
<entry name="xmlrpc_url" overwrite="true">https://sip3.linphone.org:444/wizard.php</entry>
<entry name="xmlrpc_url" overwrite="true">https://subscribe.linphone.org:444/wizard.php</entry>
</section>
</config>

View file

@ -28,6 +28,6 @@
<entry name="username_max_length" overwrite="true">64</entry>
<entry name="username_min_length" overwrite="true">1</entry>
<entry name="username_regex" overwrite="true">^[a-z0-9+_.\-]*$</entry>
<entry name="xmlrpc_url" overwrite="true">https://sip3.linphone.org:444/wizard.php</entry>
<entry name="xmlrpc_url" overwrite="true">https://subscribe.linphone.org:444/wizard.php</entry>
</section>
</config>

View file

@ -29,7 +29,7 @@ enabled=0
paid_account_id=sipAccount_12m
#the url of the inapp/account management server, for submitting the receipt and validating the account.
receipt_validation_url=https://www.linphone.org/inapp.php
receipt_validation_url=https://subscribe.linphone.org:444/inapp.php
#for future use, to specify the full list of paying services to show in the shop view
products_list=sipAccount_12m

@ -1 +1 @@
Subproject commit ee50e0e3c1863bd7924cdcf3f7fd2eb34c886195
Subproject commit 01df9f93533bb1526a673ae7c557ae2508747a49