def have_pro() -> bool: """Return whether pro is currently unlocked.""" # Check our tickets-based pro upgrade and our two real-IAP based upgrades. # Also unlock this stuff in ballistica-core builds. return bool( _ba.get_purchased('upgrades.pro') or _ba.get_purchased('static.pro') or _ba.get_purchased('static.pro_sale') or 'ballistica' + 'core' == _ba.appname())
def handle_deep_link(self, url: str) -> None: """Handle a deep link URL.""" from ba._language import Lstr appname = _ba.appname() if url.startswith(f'{appname}://code/'): code = url.replace(f'{appname}://code/', '') self.accounts.add_pending_promo_code(code) else: _ba.screenmessage(Lstr(resource='errorText'), color=(1, 0, 0)) _ba.playsound(_ba.getsound('error'))
def do_rating() -> None: import _ba if platform == 'android': appname = _ba.appname() if subplatform == 'google': url = f'market://details?id=net.froemling.{appname}' else: url = 'market://details?id=net.froemling.{appname}cb' else: url = 'macappstore://itunes.apple.com/app/id416482767?ls=1&mt=12' ba.open_url(url) ba.containerwidget(edit=dlg, transition='out_left')
def handle_deep_link(self, url: str) -> None: """Handle a deep link URL.""" from ba._lang import Lstr from ba._enums import TimeType appname = _ba.appname() if url.startswith(f'{appname}://code/'): code = url.replace(f'{appname}://code/', '') # If we're not signed in, queue up the code to run the next time we # are and issue a warning if we haven't signed in within the next # few seconds. if _ba.get_account_state() != 'signed_in': def check_pending_codes() -> None: """(internal)""" # If we're still not signed in and have pending codes, # inform the user that they need to sign in to use them. if _ba.app.pending_promo_codes: _ba.screenmessage( Lstr(resource='signInForPromoCodeText'), color=(1, 0, 0)) _ba.playsound(_ba.getsound('error')) _ba.app.pending_promo_codes.append(code) _ba.timer(6.0, check_pending_codes, timetype=TimeType.REAL) return _ba.screenmessage(Lstr(resource='submittingPromoCodeText'), color=(0, 1, 0)) _ba.add_transaction({ 'type': 'PROMO_CODE', 'expire_time': time.time() + 5, 'code': code }) _ba.run_transactions() else: _ba.screenmessage(Lstr(resource='errorText'), color=(1, 0, 0)) _ba.playsound(_ba.getsound('error'))