[inApp] waitview during pop-up process

This commit is contained in:
Brieuc Viel 2016-09-23 16:51:11 +02:00
parent ac2bb788c3
commit 672555513c
5 changed files with 51 additions and 2 deletions

View file

@ -10,6 +10,7 @@
<connections>
<outlet property="tableViewController" destination="sBe-ML-IzT" id="8zr-PW-7c4"/>
<outlet property="view" destination="HJH-1o-RXN" id="AhB-ik-484"/>
<outlet property="waitingView" destination="tuB-rE-DiO" id="1cH-Ht-tQE"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
@ -17,7 +18,7 @@
<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">
<view tag="299" contentMode="scaleToFill" id="HJH-1o-RXN">
<frame key="frameInset" minY="66"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
@ -40,7 +41,7 @@
<state key="disabled" image="dialer_back_disabled.png"/>
<state key="highlighted" backgroundImage="color_E.png"/>
<connections>
<action selector="onDialerBackClick:" destination="-1" eventType="touchUpInside" id="PJX-d2-pSh"/>
<action selector="onDialerBackClick:" destination="-1" eventType="touchUpInside" id="IrL-W4-g5z"/>
</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">
@ -61,6 +62,18 @@
<outlet property="delegate" destination="sBe-ML-IzT" id="T0H-aj-0UQ"/>
</connections>
</tableView>
<view hidden="YES" tag="288" contentMode="scaleToFill" misplaced="YES" id="tuB-rE-DiO" userLabel="waitView">
<frame key="frameInset" minY="66" maxY="-33"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<activityIndicatorView opaque="NO" tag="9" contentMode="scaleToFill" animating="YES" style="gray" id="7Jb-oC-FC5" userLabel="activityIndicatorView">
<frame key="frameInset" minX="50.42%" minY="49.82%" width="20" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
</activityIndicatorView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="0.5" colorSpace="custom" customColorSpace="sRGB"/>
<gestureRecognizers/>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>

View file

@ -24,6 +24,7 @@
#import "XMLRPCHelper.h"
#import "LinphoneManager.h"
#import "PhoneMainView.h"
#import "StoreKit/StoreKit.h"
@interface InAppProductsManager ()
@property(strong, nonatomic) NSDate *expirationDate;
@ -96,6 +97,12 @@
}
SKProduct *prod = [self productIDAvailable:productID];
if (prod) {
// Display waitview on click
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
UIView *topView = window.rootViewController.view;
UIView *waitview = (UIView *)[topView viewWithTag:288];
[waitview setHidden:FALSE];
NSDictionary *dict = @{ @"product_id" : productID };
[self postNotificationforStatus:kIAPPurchaseTrying withDict:dict];
SKMutablePayment *payment = [SKMutablePayment paymentWithProduct:prod];
@ -189,6 +196,7 @@
}
- (void)dealWithXmlRpcResponse:(LinphoneXmlRpcRequest *)request {
//[ShopView hideWaitingView:TRUE];
LOGI(@"XMLRPC query ");
const char *requestContent = linphone_xml_rpc_request_get_content(request);
NSString *rContent = [NSString stringWithFormat:@"%s", requestContent];
@ -330,6 +338,10 @@
onSuccess:^(NSString *response) {
if (response) {
LOGI(@"create and activate_account callback - response: %@", response);
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
UIView *topView = window.rootViewController.view;
UIView *waitview = (UIView *)[topView viewWithTag:288];
[waitview setHidden:TRUE];
}
}];
@ -343,6 +355,10 @@
onSuccess:^(NSString *response) {
if (response) {
LOGI(@"update_expiration_date callback - response: %@", response);
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
UIView *topView = window.rootViewController.view;
UIView *waitview = (UIView *)[topView viewWithTag:288];
[waitview setHidden:TRUE];
}
}];

View file

@ -7,6 +7,8 @@
//
#import "ShopTableView.h"
#import "ShopView.h"
#import "PhoneMainView.h"
@implementation ShopTableView
@ -58,6 +60,13 @@
SKProduct *product = LinphoneManager.instance.iapManager.productsAvailable[indexPath.row];
[LinphoneManager.instance.iapManager purchaseWithID:product.productIdentifier];
/* UIWindow *window = [[UIApplication sharedApplication] keyWindow];
UIView *topView = window.rootViewController.view;
UIView *waitview = (UIView*)[topView viewWithTag:288];
[waitview setHidden:FALSE];
*/
}
@end

View file

@ -25,6 +25,8 @@
@interface ShopView : UIViewController <UICompositeViewDelegate>
@property(strong, nonatomic) IBOutlet ShopTableView *tableViewController;
@property(weak, nonatomic) IBOutlet UIView *waitingView;
- (IBAction)onDialerBackClick:(id)sender;
- (void)hideWaitingView;
@end

View file

@ -55,4 +55,13 @@ static UICompositeViewDescription *compositeDescription = nil;
[PhoneMainView.instance popToView:DialerView.compositeViewDescription];
}
- (IBAction)hideWaitingView {
LOGE(@"====>>> ShopView hideWaitingView - bool = %d");
if (_waitingView.isHidden) {
[_waitingView setHidden:NO];
} else {
[_waitingView setHidden:YES];
}
}
@end