def share_with_team_member(email): auth = Auth() siphon = Siphon(auth.auth_token) conf = Config() # Prompt the user with implications before we do anything. puts(colored.yellow('Checking the sharing status for this app...')) sharing_status = siphon.get_sharing_status(conf.app_id) shared_with = sharing_status.get('shared_with', []) if not prompt_team_share(shared_with): return siphon.share(conf.app_id, 'team-member', email) puts(colored.green('Your app was shared successfully.')) mixpanel_event(MIXPANEL_SHARE_TEAM_MEMBER)
def share_with_beta_tester(email=None): auth = Auth() siphon = Siphon(auth.auth_token) conf = Config() # Prompt the user with implications before we do anything. puts(colored.yellow('Checking the sharing status for this app...')) sharing_status = siphon.get_sharing_status(conf.app_id) shared_with = sharing_status.get('shared_with', []) if email: if not prompt_beta_share_for_specific_email(shared_with): return else: if len(shared_with) < 1: msg = 'Running the "siphon share" command without specifying ' \ 'an email address is only valid if you have one-or-more ' \ 'beta testers who already accepted an invitation.' puts(colored.red(msg)) return if not prompt_beta_share_for_all(shared_with): return # Do a push to the *aliased* beta testing app. puts(colored.green('Pushing your local files for beta testing...')) aliased_app_id = sharing_status['aliased_app']['id'] if not push(app_id=aliased_app_id, track_event=False): puts(colored.red('\nThe push failed so your beta testers were not ' \ 'notified.')) return # We only need to add a sharing permission if an email was specified, # because the push itself triggers notifications. if email is not None: siphon.share(conf.app_id, 'beta-tester', email) puts(colored.green('\nYour app was shared successfully.')) mixpanel_event(MIXPANEL_SHARE_BETA_TESTER)