diff --git a/Classes/InAppProductsCell.h b/Classes/InAppProductsCell.h deleted file mode 100644 index 4efa640ee..000000000 --- a/Classes/InAppProductsCell.h +++ /dev/null @@ -1,27 +0,0 @@ -// -// InAppProductsCell.h -// linphone -// -// Created by Gautier Pelloux-Prayer on 15/04/15. -// -// - -#import -#import - -@interface InAppProductsCell : UITableViewCell { -} -@property (strong, nonatomic) IBOutlet UILabel *ptitle; -@property (strong, nonatomic) IBOutlet UILabel *pdescription; -@property (strong, nonatomic) IBOutlet UILabel *pprice; -@property (strong, nonatomic) IBOutlet UISwitch *ppurchased; -@property (nonatomic) BOOL isMaximized; -@property (strong, nonatomic) NSString *productID; - -- (id)initWithIdentifier:(NSString*)identifier maximized:(bool)maximized; - -+ (CGFloat)getHeight:(BOOL)maximized; - -- (void)fillFromProduct:(SKProduct*)prod; - -@end diff --git a/Classes/InAppProductsCell.m b/Classes/InAppProductsCell.m deleted file mode 100644 index e0e8ea763..000000000 --- a/Classes/InAppProductsCell.m +++ /dev/null @@ -1,60 +0,0 @@ -// -// InAppProductsCell.m -// linphone -// -// Created by Gautier Pelloux-Prayer on 15/04/15. -// -// - -#import "InAppProductsCell.h" -#import "LinphoneManager.h" - -@implementation InAppProductsCell - -- (void)setIsMaximized:(BOOL)isMaximized { - _isMaximized = isMaximized; - - //show the BUY button only when not maximized -// _buyButton.hidden = !isMaximized; - - self.frame = CGRectMake(self.frame.origin.x, - self.frame.origin.y, - self.frame.size.width, - [InAppProductsCell getHeight:isMaximized]); -} - -- (void)fillFromProduct:(SKProduct *)prod { - NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; - [formatter setLocale:prod.priceLocale]; - [formatter setNumberStyle:NSNumberFormatterCurrencyStyle]; - NSString * formattedPrice = [formatter stringFromNumber:prod.price]; - - [_ptitle setText: [prod localizedTitle]]; - [_pdescription setText: [prod localizedDescription]]; - [_pprice setText: formattedPrice]; - [_ppurchased setOn: [[[LinphoneManager instance] iapManager] isPurchasedWithID:prod.productIdentifier]]; - _productID = prod.productIdentifier; -} -- (id)initWithIdentifier:(NSString*)identifier maximized:(bool)maximized { - if ((self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier]) != nil) { - NSArray *arrayOfViews = [[NSBundle mainBundle] loadNibNamed:@"InAppProductsCell" - owner:self - options:nil]; - if ([arrayOfViews count] >= 1) { - [self.contentView addSubview:[arrayOfViews objectAtIndex:0]]; - } - _isMaximized = maximized; - } - return self; -} - - -- (NSString *)description { - return [NSString stringWithFormat:@"%@ (%@): %@ (%@)", _ptitle.text, _pprice.text, _pdescription.text, _isMaximized ? @"maximized":@"minimized"]; -} - -+ (CGFloat)getHeight:(BOOL)maximized { - return maximized ? 40 : 40; -} - -@end diff --git a/Classes/InAppProductsCell.xib b/Classes/InAppProductsCell.xib deleted file mode 100644 index 73791c7a4..000000000 --- a/Classes/InAppProductsCell.xib +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Classes/InAppProductsManager.m b/Classes/InAppProductsManager.m index 847697868..f4e77fac9 100644 --- a/Classes/InAppProductsManager.m +++ b/Classes/InAppProductsManager.m @@ -29,7 +29,6 @@ #import "LinphoneManager.h" #import "PhoneMainView.h" -#import "InAppProductsViewController.h" @interface InAppProductsManager() @property (strong, nonatomic) NSDate *expirationDate; diff --git a/Classes/InAppProductsTableViewController.h b/Classes/InAppProductsTableViewController.h deleted file mode 100644 index a98352c37..000000000 --- a/Classes/InAppProductsTableViewController.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// InAppProductsTableViewController.h -// linphone -// -// Created by Gautier Pelloux-Prayer on 16/04/15. -// -// - -#import - -@interface InAppProductsTableViewController : UITableViewController - -@end diff --git a/Classes/InAppProductsTableViewController.m b/Classes/InAppProductsTableViewController.m deleted file mode 100644 index 6c5232283..000000000 --- a/Classes/InAppProductsTableViewController.m +++ /dev/null @@ -1,78 +0,0 @@ -// -// InAppProductsTableViewController.m -// linphone -// -// Created by Gautier Pelloux-Prayer on 16/04/15. -// -// - -#import "InAppProductsTableViewController.h" -#import "InAppProductsCell.h" -#import "InAppProductsManager.h" -#import "LinphoneManager.h" -#import "DTAlertView.h" - -@implementation InAppProductsTableViewController { - NSInteger currentExpanded; - InAppProductsManager *iapm; -} - -- (void)viewWillAppear:(BOOL)animated { - currentExpanded = -1; - iapm = [[LinphoneManager instance] iapManager]; -} - -#pragma mark - Table view data source - -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - return 1; -} - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return [iapm productsAvailable].count; -} - -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *kCellId = @"InAppProductsCell"; - InAppProductsCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellId]; - if (cell == nil) { - cell = [[InAppProductsCell alloc] initWithIdentifier:kCellId maximized:(currentExpanded == indexPath.row)]; - } - SKProduct *prod = [[[[LinphoneManager instance] iapManager] productsAvailable] objectAtIndex:indexPath.row]; - [cell fillFromProduct:prod]; - cell.isMaximized = (currentExpanded == indexPath.row); - return cell; -} - -//- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { -// if(currentExpanded == indexPath.row) { -// currentExpanded = -1; -// [tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; -// return; -// } else if(currentExpanded >= 0) { -// NSIndexPath *previousPath = [NSIndexPath indexPathForRow:currentExpanded inSection:0]; -// currentExpanded = indexPath.row; -// [tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:previousPath] withRowAnimation:UITableViewRowAnimationFade]; -// } -// currentExpanded = indexPath.row; -// [tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; -//} - -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - InAppProductsCell *cell = (InAppProductsCell*)[tableView cellForRowAtIndexPath:indexPath]; - if (cell.ppurchased.isOn) { - DTAlertView* alert = [[DTAlertView alloc] initWithTitle:NSLocalizedString(@"Already purchased", nil) message: [NSString stringWithFormat:NSLocalizedString(@"You already bought %@.",nil), cell.ptitle.text]]; - - [alert addCancelButtonWithTitle:NSLocalizedString(@"OK", nil) block:nil]; - [alert show]; - } else { - //try to purchase item, and if successfull change the switch - [[[LinphoneManager instance] iapManager] purchaseWitID: cell.productID]; - } -} - --(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { - return [InAppProductsCell getHeight:(currentExpanded == indexPath.row)]; -} - -@end diff --git a/Classes/InAppProductsViewController.h b/Classes/InAppProductsViewController.h deleted file mode 100644 index 84ad3469d..000000000 --- a/Classes/InAppProductsViewController.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// InAppProductsViewController.h -// linphone -// -// Created by Gautier Pelloux-Prayer on 15/04/15. -// -// - -#import -#import "UICompositeViewController.h" -#import "InAppProductsTableViewController.h" - -@interface InAppProductsViewController : UIViewController { -} - -@property (nonatomic, strong) IBOutlet InAppProductsTableViewController* tableController; -@property (strong, nonatomic) IBOutlet UIView *waitView; -- (IBAction)onRestoreClicked:(UIButton *)sender; - -@end diff --git a/Classes/InAppProductsViewController.m b/Classes/InAppProductsViewController.m deleted file mode 100644 index 2154a82b0..000000000 --- a/Classes/InAppProductsViewController.m +++ /dev/null @@ -1,80 +0,0 @@ -// -// InAppProductsViewController.m -// linphone -// -// Created by Gautier Pelloux-Prayer on 15/04/15. -// -// - -#import "InAppProductsViewController.h" -#import "InAppProductsCell.h" - -@implementation InAppProductsViewController - -#pragma mark - Lifecycle Functions - -- (id)init { - return [super initWithNibName:@"InAppProductsViewController" bundle:[NSBundle mainBundle]]; -} - - -- (void)dealloc { - [[NSNotificationCenter defaultCenter] removeObserver:self]; - - -} - -#pragma mark - ViewController Functions - -- (void)viewDidLoad { - [super viewDidLoad]; -} - -- (void)viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; - for (NSString* notification in [NSArray arrayWithObjects:kIAPReady, kIAPRestoreSucceeded, kIAPPurchaseSucceeded, kIAPReceiptSucceeded, kIAPPurchaseTrying, nil]) { - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(onIAPPurchaseNotification:) - name:notification - object:nil]; - } -} - -- (void)viewWillDisappear:(BOOL)animated { - [super viewWillDisappear:animated]; - for (NSString* notification in [NSArray arrayWithObjects:kIAPReady, kIAPRestoreSucceeded, kIAPPurchaseSucceeded, kIAPReceiptSucceeded, kIAPPurchaseTrying, nil]) { - [[NSNotificationCenter defaultCenter] removeObserver:self - name:notification - object:nil]; - } -} - -- (void)onIAPPurchaseNotification:(NSNotification*)notif { - InAppProductsManager *iapm = [[LinphoneManager instance] iapManager]; - [[_tableController tableView] reloadData]; - [_waitView setHidden:([[iapm productsAvailable] count] != 0 && ![notif.name isEqualToString:kIAPPurchaseTrying])]; -} - -#pragma mark - UICompositeViewDelegate Functions - -static UICompositeViewDescription *compositeDescription = nil; - -+ (UICompositeViewDescription *)compositeViewDescription { - if(compositeDescription == nil) { - compositeDescription = [[UICompositeViewDescription alloc] init:@"InAppProducts" - content:@"InAppProductsViewController" - stateBar:nil - stateBarEnabled:false - tabBar: @"UIMainBar" - tabBarEnabled:true - fullscreen:false - landscapeMode:[LinphoneManager runningOnIpad] - portraitMode:true]; - } - return compositeDescription; -} - -- (IBAction)onRestoreClicked:(UIButton *)sender { - [[[LinphoneManager instance] iapManager] restore]; -} -@end \ No newline at end of file diff --git a/Classes/InAppProductsViewController.xib b/Classes/InAppProductsViewController.xib deleted file mode 100644 index 4864c1eb0..000000000 --- a/Classes/InAppProductsViewController.xib +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index d5a9eeec8..2298bd5f1 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -20,7 +20,6 @@ #import #import -#import "InAppProductsViewController.h" #import "LinphoneAppDelegate.h" #import "PhoneMainView.h" #import "Utils.h" diff --git a/Classes/SettingsViewController.m b/Classes/SettingsViewController.m index d1a07dec2..9fab910a9 100644 --- a/Classes/SettingsViewController.m +++ b/Classes/SettingsViewController.m @@ -22,7 +22,6 @@ #import "PhoneMainView.h" #import "UILinphone.h" #import "UACellBackgroundView.h" -#import "InAppProductsViewController.h" #import "DCRoundSwitch.h" @@ -770,8 +769,6 @@ static UICompositeViewDescription *compositeDescription = nil; } [self emailAttachment:[NSData dataWithContentsOfFile:[NSString stringWithUTF8String:filepath]] mimeType:mimeType name:filename]; ms_free(filepath); - } else if([key isEqual:@"in_app_products_button"]) { - [[PhoneMainView instance] changeCurrentView:[InAppProductsViewController compositeViewDescription] push:TRUE]; } } diff --git a/Settings/InAppSettings.bundle/Root.plist b/Settings/InAppSettings.bundle/Root.plist index a3ad75a6c..90c75b377 100644 --- a/Settings/InAppSettings.bundle/Root.plist +++ b/Settings/InAppSettings.bundle/Root.plist @@ -242,14 +242,6 @@ Type PSChildPaneSpecifier - - Key - in_app_products_button - Title - Extra features - Type - IASKButtonSpecifier - Title Development debug actions diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index c31fe3c6b..b96c6ad3b 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -111,11 +111,6 @@ 630CF5571AF7CE1500539F7A /* UITextField+DoneButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 630CF5561AF7CE1500539F7A /* UITextField+DoneButton.m */; }; 631C4FB119D2A8F2004BFE77 /* UIDigitButtonLongPlus.m in Sources */ = {isa = PBXBuildFile; fileRef = 631C4FB019D2A8F2004BFE77 /* UIDigitButtonLongPlus.m */; }; 631C4FB719D2C3A6004BFE77 /* UIDigitButtonLongVoiceMail.m in Sources */ = {isa = PBXBuildFile; fileRef = 631C4FB619D2C3A6004BFE77 /* UIDigitButtonLongVoiceMail.m */; }; - 6359DE7F1ADEB54200EA15C0 /* InAppProductsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6359DE7D1ADEB54200EA15C0 /* InAppProductsViewController.m */; }; - 6359DE801ADEB54200EA15C0 /* InAppProductsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6359DE7E1ADEB54200EA15C0 /* InAppProductsViewController.xib */; }; - 6359DE841ADEB64100EA15C0 /* InAppProductsCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6359DE821ADEB64100EA15C0 /* InAppProductsCell.m */; }; - 6359DE851ADEB64100EA15C0 /* InAppProductsCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6359DE831ADEB64100EA15C0 /* InAppProductsCell.xib */; }; - 6359DE8B1ADF9EB900EA15C0 /* InAppProductsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6359DE8A1ADF9EB900EA15C0 /* InAppProductsTableViewController.m */; }; 636316D11A1DEBCB0009B839 /* AboutViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 636316D31A1DEBCB0009B839 /* AboutViewController.xib */; }; 636316D41A1DEC650009B839 /* SettingsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 636316D61A1DEC650009B839 /* SettingsViewController.xib */; }; 636316D91A1DECC90009B839 /* PhoneMainView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 636316D71A1DECC90009B839 /* PhoneMainView.xib */; }; @@ -1023,14 +1018,6 @@ 631C4FB519D2C3A6004BFE77 /* UIDigitButtonLongVoiceMail.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIDigitButtonLongVoiceMail.h; sourceTree = ""; }; 631C4FB619D2C3A6004BFE77 /* UIDigitButtonLongVoiceMail.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIDigitButtonLongVoiceMail.m; sourceTree = ""; }; 633E388219FFB0F400936D1C /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; - 6359DE7C1ADEB54200EA15C0 /* InAppProductsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InAppProductsViewController.h; sourceTree = ""; }; - 6359DE7D1ADEB54200EA15C0 /* InAppProductsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InAppProductsViewController.m; sourceTree = ""; }; - 6359DE7E1ADEB54200EA15C0 /* InAppProductsViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = InAppProductsViewController.xib; sourceTree = ""; }; - 6359DE811ADEB64100EA15C0 /* InAppProductsCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InAppProductsCell.h; sourceTree = ""; }; - 6359DE821ADEB64100EA15C0 /* InAppProductsCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InAppProductsCell.m; sourceTree = ""; }; - 6359DE831ADEB64100EA15C0 /* InAppProductsCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = InAppProductsCell.xib; sourceTree = ""; }; - 6359DE891ADF9EB900EA15C0 /* InAppProductsTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InAppProductsTableViewController.h; sourceTree = ""; }; - 6359DE8A1ADF9EB900EA15C0 /* InAppProductsTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InAppProductsTableViewController.m; sourceTree = ""; }; 636316D21A1DEBCB0009B839 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/AboutViewController.xib; sourceTree = ""; }; 636316D51A1DEC650009B839 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/SettingsViewController.xib; sourceTree = ""; }; 636316D81A1DECC90009B839 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/PhoneMainView.xib; sourceTree = ""; }; @@ -2043,16 +2030,8 @@ 22405EFD1601C19000B92522 /* ImageViewController.h */, 22405EFE1601C19100B92522 /* ImageViewController.m */, D37EE11016035793003608A6 /* ImageViewController.xib */, - 6359DE811ADEB64100EA15C0 /* InAppProductsCell.h */, - 6359DE821ADEB64100EA15C0 /* InAppProductsCell.m */, - 6359DE831ADEB64100EA15C0 /* InAppProductsCell.xib */, 63E59A3D1ADE6ECB00646FB3 /* InAppProductsManager.h */, 63E59A3E1ADE70D900646FB3 /* InAppProductsManager.m */, - 6359DE891ADF9EB900EA15C0 /* InAppProductsTableViewController.h */, - 6359DE8A1ADF9EB900EA15C0 /* InAppProductsTableViewController.m */, - 6359DE7C1ADEB54200EA15C0 /* InAppProductsViewController.h */, - 6359DE7D1ADEB54200EA15C0 /* InAppProductsViewController.m */, - 6359DE7E1ADEB54200EA15C0 /* InAppProductsViewController.xib */, D31AAF5C159B3919002C6B02 /* InCallTableViewController.h */, D31AAF5D159B3919002C6B02 /* InCallTableViewController.m */, D3F83EE91582021700336684 /* InCallViewController.h */, @@ -3342,7 +3321,6 @@ D38327F71580FE3A00FA0D23 /* settings_default.png in Resources */, D38327F81580FE3A00FA0D23 /* settings_selected.png in Resources */, D38327F91580FE3A00FA0D23 /* chat_default.png in Resources */, - 6359DE801ADEB54200EA15C0 /* InAppProductsViewController.xib in Resources */, D38327FA1580FE3A00FA0D23 /* chat_selected.png in Resources */, D3832800158100E400FA0D23 /* contacts_over.png in Resources */, D3832801158100E400FA0D23 /* history_over.png in Resources */, @@ -3379,7 +3357,6 @@ D3F83F581582223B00336684 /* numpad_five_default.png in Resources */, D3F83F5A1582223B00336684 /* numpad_five_over.png in Resources */, D3F83F5C1582223B00336684 /* numpad_six_default.png in Resources */, - 6359DE851ADEB64100EA15C0 /* InAppProductsCell.xib in Resources */, 636316D91A1DECC90009B839 /* PhoneMainView.xib in Resources */, D3F83F5E1582223B00336684 /* numpad_six_over.png in Resources */, D3F83F601582223B00336684 /* numpad_seven_default.png in Resources */, @@ -4052,14 +4029,11 @@ D3807FFC15C2894A005BE9BC /* IASKPSTitleValueSpecifierViewCell.m in Sources */, D3807FFE15C2894A005BE9BC /* IASKSlider.m in Sources */, D380800015C2894A005BE9BC /* IASKSwitch.m in Sources */, - 6359DE8B1ADF9EB900EA15C0 /* InAppProductsTableViewController.m in Sources */, D380800215C2894A005BE9BC /* IASKTextField.m in Sources */, D380800515C28A7A005BE9BC /* UILinphone.m in Sources */, D380801315C299D0005BE9BC /* ColorSpaceUtilites.m in Sources */, - 6359DE7F1ADEB54200EA15C0 /* InAppProductsViewController.m in Sources */, 637157A11B283FE200C91677 /* FileTransferDelegate.m in Sources */, D378AB2A15DCDB4A0098505D /* ImagePickerViewController.m in Sources */, - 6359DE841ADEB64100EA15C0 /* InAppProductsCell.m in Sources */, 22405F001601C19200B92522 /* ImageViewController.m in Sources */, D3ED40191602172200BF332B /* HPGrowingTextView.m in Sources */, D3ED401B1602172200BF332B /* HPTextViewInternal.m in Sources */,