diff --git a/Sources/Earthquake Network/Costanti.h b/Sources/Earthquake Network/Costanti.h index ba18936..3748dd7 100644 --- a/Sources/Earthquake Network/Costanti.h +++ b/Sources/Earthquake Network/Costanti.h @@ -316,7 +316,6 @@ typedef enum : NSInteger { #define EQN_ADMOB_ANNUNCIO_IDA_TEST @"ca-app-pub-3940256099942544/2934735716" // ACQUISTI IN APP -#define EQN_ACQ_IN_APP @"EQN_ACQ_IN_APP" #define CONTEGGIO_APERTURE_PER_SCONTO @"CONTEGGIO_APERTURE_PER_SCONTO" #define PREZZO_SCONTATO_SCADUTO @"PREZZO_SCONTATO_SCADUTO" #define IAPHelperPurchaseNotification @"IAPHelperPurchaseNotification" diff --git a/Sources/Earthquake Network/ViewController/Dettagli mappa/PastquakesDettagliMappa.m b/Sources/Earthquake Network/ViewController/Dettagli mappa/PastquakesDettagliMappa.m index b7e3e22..6184fff 100644 --- a/Sources/Earthquake Network/ViewController/Dettagli mappa/PastquakesDettagliMappa.m +++ b/Sources/Earthquake Network/ViewController/Dettagli mappa/PastquakesDettagliMappa.m @@ -57,12 +57,7 @@ [self.buttonAzione addTarget:self action:@selector(visualizzaPikerFiltro:) forControlEvents:UIControlEventTouchDown]; [self applicaFiltroWithTime:@(2)]; - if ([[NSUserDefaults standardUserDefaults] boolForKey:EQN_ACQ_IN_APP]) - NSLog(@"ciao"); - else - self.bannerView = [EQNUtility ottieniBannerWithController:self position:NO]; - - + self.bannerView = [EQNUtility ottieniBannerWithController:self position:NO]; } - (void)didReceiveMemoryWarning { diff --git a/Sources/Earthquake Network/ViewController/Dettagli mappa/ReteSismiDettagliMappa.m b/Sources/Earthquake Network/ViewController/Dettagli mappa/ReteSismiDettagliMappa.m index a157d5e..e35454a 100644 --- a/Sources/Earthquake Network/ViewController/Dettagli mappa/ReteSismiDettagliMappa.m +++ b/Sources/Earthquake Network/ViewController/Dettagli mappa/ReteSismiDettagliMappa.m @@ -36,10 +36,7 @@ } - if (![[NSUserDefaults standardUserDefaults] boolForKey:EQN_ACQ_IN_APP]){ - self.bannerView = [EQNUtility ottieniBannerWithController:self position:YES]; - - } + self.bannerView = [EQNUtility ottieniBannerWithController:self position:YES]; } - (void)didReceiveMemoryWarning { diff --git a/Sources/Earthquake Network/ViewController/Dettagli mappa/SegnalazioniUtenteDettagliMappa.m b/Sources/Earthquake Network/ViewController/Dettagli mappa/SegnalazioniUtenteDettagliMappa.m index 38520c3..5affc34 100644 --- a/Sources/Earthquake Network/ViewController/Dettagli mappa/SegnalazioniUtenteDettagliMappa.m +++ b/Sources/Earthquake Network/ViewController/Dettagli mappa/SegnalazioniUtenteDettagliMappa.m @@ -49,10 +49,7 @@ [self.buttonAzione addTarget:self action:@selector(visualizzaPikerFiltro:) forControlEvents:UIControlEventTouchDown]; [self applicaFiltroWithTime:@(0)]; - if (![[NSUserDefaults standardUserDefaults] boolForKey:EQN_ACQ_IN_APP]){ - self.bannerView = [EQNUtility ottieniBannerWithController:self position:NO]; - - } + self.bannerView = [EQNUtility ottieniBannerWithController:self position:NO]; } - (void)didReceiveMemoryWarning { diff --git a/Sources/Earthquake Network/ViewController/MasterViewController.m b/Sources/Earthquake Network/ViewController/MasterViewController.m index e24d61f..93ad41d 100644 --- a/Sources/Earthquake Network/ViewController/MasterViewController.m +++ b/Sources/Earthquake Network/ViewController/MasterViewController.m @@ -49,27 +49,17 @@ [self sincronizza]; - + // check for an AppStore receipt NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL]; NSData *receipt = [NSData dataWithContentsOfURL:receiptURL]; - if (!receipt) { /* No local receipt -- handle the error. */ - - [[NSUserDefaults standardUserDefaults] setBool:NO forKey:EQN_ACQ_IN_APP]; - self.bannerView = [EQNUtility ottieniBannerWithController:self position:YES]; - - } else { - + if (receipt) { [[ServerRequest defaultServerConnectionSingleton] inviaRicevuta:receipt success:^(id result) { - + // nope } failure:^(NSError *error) { - + // nope }]; - - } - /* ... Send the receipt data to your server ... */ - SWRevealViewController *revealViewController = self.revealViewController; if ( revealViewController ) { @@ -105,9 +95,7 @@ [self caricaChildrenViewController:[NSIndexPath indexPathForRow:0 inSection:0]]; - if (![[NSUserDefaults standardUserDefaults] boolForKey:EQN_ACQ_IN_APP]){ - self.bannerView = [EQNUtility ottieniBannerWithController:self position:YES]; - } + self.bannerView = [EQNUtility ottieniBannerWithController:self position:YES]; } -(void)registraNotifiche{ diff --git a/Sources/Earthquake Network/model/EQNUtility.h b/Sources/Earthquake Network/model/EQNUtility.h index d2a03a8..0b9375e 100644 --- a/Sources/Earthquake Network/model/EQNUtility.h +++ b/Sources/Earthquake Network/model/EQNUtility.h @@ -12,6 +12,8 @@ #import "MasterViewController.h" @import GoogleMobileAds; +NS_ASSUME_NONNULL_BEGIN + @interface EQNUtility : NSObject +(NSDate *)getDataFromString:(NSString *)stringData; @@ -34,7 +36,13 @@ +(UIViewController *)shareFileWithPath:(id)path; +(NSArray *)arrayDescrizioneEnti; -+(GADBannerView *)ottieniBannerWithController:(UIViewController *)controller position:(BOOL)isButton; +/// Creates Ad-sense banner to show on a given controller +/// This method returns nil if the user has a Pro version, no banner has to be shown +/// @param controller Controller +/// @param isButton Is button ++(nullable GADBannerView *)ottieniBannerWithController:(UIViewController *)controller position:(BOOL)isButton; @end + +NS_ASSUME_NONNULL_END diff --git a/Sources/Earthquake Network/model/EQNUtility.m b/Sources/Earthquake Network/model/EQNUtility.m index d20fa43..365a43e 100644 --- a/Sources/Earthquake Network/model/EQNUtility.m +++ b/Sources/Earthquake Network/model/EQNUtility.m @@ -373,9 +373,6 @@ +(GADBannerView *)ottieniBannerWithController:(UIViewController *)controller position:(BOOL)isButton { if ([EQNPurchaseUtility isProVersionEnabled]) { - [[NSUserDefaults standardUserDefaults] setBool:TRUE forKey:EQN_ACQ_IN_APP]; - [[NSUserDefaults standardUserDefaults] synchronize]; - return nil; }