def _process_purchase(self):
     Logger.info('in purchase')
     if not netcheck.connection_available():
         Logger.info('no net avaiable')
         netcheck.ask_connect(self._connection_callback)
     elif not self.setup_complete:
         Logger.info('setup not complete')
         self._setup()
     else:
         Logger.info('doing the purchase')
         Logger.info(str(self.purchase_requested))
         if self.purchase_requested is not None:
             sku = self.purchasing = self.purchase_requested
         else:
             self.purchasing = self.purchase_requested = None
             Logger.info('returning for no good reason')
             return
         if sku not in self.skus:
             raise AttributeError('The sku is not in the skus you initialized with')
         Logger.info('Starting purchase workflow for ' + sku)
         c = cast('android.app.Activity', context)
         r = self.r_code
         p = _OnPurchaseFinishedListener(self._purchase_finished)
         _protect_callback(p)
         self.helper.launchPurchaseFlow(c, sku, r, p)
Exemple #2
0
 def _process_purchase(self):
     Logger.info('in purchase')
     if not netcheck.connection_available():
         Logger.info('no net avaiable')
         netcheck.ask_connect(self._connection_callback)
     elif not self.setup_complete:
         Logger.info('setup not complete')
         self._setup()
     else:
         Logger.info('doing the purchase')
         Logger.info(str(self.purchase_requested))
         if self.purchase_requested is not None:
             sku = self.purchasing = self.purchase_requested
         else:
             self.purchasing = self.purchase_requested = None
             Logger.info('returning for no good reason')
             return
         if sku not in self.skus:
             raise AttributeError(
                 'The sku is not in the skus you initialized with')
         Logger.info('Starting purchase workflow for ' + sku)
         c = cast('android.app.Activity', context)
         r = self.r_code
         p = _OnPurchaseFinishedListener(self._purchase_finished)
         _protect_callback(p)
         self.helper.launchPurchaseFlow(c, sku, r, p)
 def _process_request(self):
     if not netcheck.connection_available():
         netcheck.ask_connect(self._connection_callback)
     elif not self._auth_state == "authenticated":
         self._authenticate()
     else:
         self.request.process(self.request)
Exemple #4
0
 def _process_request(self):
     if not netcheck.connection_available():
         netcheck.ask_connect(self._connection_callback)
     elif not self._auth_state == 'authenticated':
         self._authenticate()
     else:
         self.request.process(self.request)
Exemple #5
0
 def _process_request(self):
     if not self._tries > 0:
         self._fail()
     elif not netcheck.connection_available():
         netcheck.ask_connect(self._connection_callback)
     elif not self._auth_state == 'authenticated':
         self._authenticate()
     else:
         self._toast('Tweet Started')
         self._run_async(partial(self.request.process, self.request))
Exemple #6
0
 def _try_request(self, r):
     if self._pending_request is not None:
         Logger.info('request already in progress')
         return False
     elif not netcheck.connection_available():
         self._pending_request = r
         netcheck.ask_connect(self._connection_callback)
         return True
     else:
         Logger.info('doing it now')
     self._pending_request = r
     # this is a pretty robust way to end up processing the request
     self._open()
     return True
 def _try_request(self, r):
     if self._pending_request is not None:
         Logger.info('request already in progress')
         return False
     elif not netcheck.connection_available():
         self._pending_request = r
         netcheck.ask_connect(self._connection_callback)
         return True
     else:
         Logger.info('doing it now')
     self._pending_request = r
     # this is a pretty robust way to end up processing the request
     self._open()
     return True
Exemple #8
0
 def _setup(self, *args):
     Clock.unschedule(self._setup)
     if not self.syncing and not \
        (hasattr(self, 'helper') and self.helper.mSetupDone) and \
        netcheck.connection_available():
         self.syncing = True
         Logger.info('Attempting startup')
         k = self.app_public_key
         c = cast('android.app.Activity', context)
         self.helper = helper = IabHelper(c, k)
         # prints a lot of useful messages that might
         # not make it back to python space
         helper.enableDebugLogging(DEBUG)
         s = _OnIabSetupFinishedListener(self._setup_callback)
         _protect_callback(s)
         self.helper.startSetup(s)
 def _setup(self, *args):
     Clock.unschedule(self._setup)
     if not self.syncing and not \
        (hasattr(self, 'helper') and self.helper.mSetupDone) and \
        netcheck.connection_available():
         self.syncing = True
         Logger.info('Attempting startup')
         k = self.app_public_key
         c = cast('android.app.Activity', context)
         self.helper = helper = IabHelper(c, k)
         # prints a lot of useful messages that might
         # not make it back to python space
         helper.enableDebugLogging(DEBUG)
         s = _OnIabSetupFinishedListener(self._setup_callback)
         _protect_callback(s)
         self.helper.startSetup(s)
Exemple #10
0
 def _try_request(self, r):
     if self._pending_request is not None:
         self._toast('request already in progress')
         return False
     elif not netcheck.connection_available():
         self._pending_request = r
         netcheck.ask_connect(self._connection_callback)
         return True
     elif not self.is_open:
         self._toast('will facebook shortly')
     else:
         self._toast('facebooking')
     self._pending_request = r
     # this is a pretty robust way to end up processing the request
     self._open()
     return True
 def _try_request(self, r):
     if self._pending_request is not None:
         self._toast('request already in progress')
         return False
     elif not netcheck.connection_available():
         self._pending_request = r
         netcheck.ask_connect(self._connection_callback)
         return True
     elif not self.is_open:
         self._toast('will facebook shortly')
     else:
         self._toast('facebooking')
     self._pending_request = r
     # this is a pretty robust way to end up processing the request
     self._open()
     return True
 def _process_purchase(self):
     sku = self.purchasing
     if not netcheck.connection_available():
         netcheck.ask_connect(self._connection_callback)
     else:
         def purchase_response(dt):
             if PURCHASE_SUCCESS:
                 c = self.consumed
                 if c.has_key(sku):
                     self.consumed[sku] += 1
                 else:
                     self.consumed[sku] = 1 
                 self.purchase_callback(True, '')
             else:
                 self._fail()
         Clock.schedule_once(purchase_response, 0.5)
    def _process_purchase(self):
        sku = self.purchasing
        if not netcheck.connection_available():
            netcheck.ask_connect(self._connection_callback)
        else:

            def purchase_response(dt):
                if PURCHASE_SUCCESS:
                    c = self.consumed
                    if c.has_key(sku):
                        self.consumed[sku] += 1
                    else:
                        self.consumed[sku] = 1
                    self.purchase_callback(True, '')
                else:
                    self._fail()

            Clock.schedule_once(purchase_response, 0.5)