# Path: kano_world/functions.py
# def login_using_token():
#     if is_registered():
#         return True, None
#     return False, _("User is not logged in")
# 
# Path: kano_world/share.py
# def upload_share(file_path, title, app_name):
#     glob_session = get_glob_session()
#     if not glob_session:
#         return False, _("You are not logged in!")
# 
#     return glob_session.upload_share(file_path, title, app_name)


from kano.utils.shell import run_cmd
from .functions import login_using_token
from .share import upload_share
# share_helpers.py
#
# Copyright (C) 2016-2017 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2





def login_and_share(file_path, title, app_name):
    """ Make a share to Kano World. If the user is not logged in, present the
    register/login window to the user.

    :param file_path: Code file to be uploaded to Kano World
    :type file_path: str

    :param title: Title for the share
    :type title: str

    :param app_name: App making the share
    :type app_name: str

    :returns: Success, error message or None
    :rtype: Tuple of (bool, str)
    """

# Path: kano_world/functions.py
# def login_using_token():
#     if is_registered():
#         return True, None
#     return False, _("User is not logged in")
# 
# Path: kano_world/share.py
# def upload_share(file_path, title, app_name):
#     glob_session = get_glob_session()
#     if not glob_session:
#         return False, _("You are not logged in!")
# 
#     return glob_session.upload_share(file_path, title, app_name)


# Path: kano_world/share_helpers.py
from kano.utils.shell import run_cmd
from .functions import login_using_token
from .share import upload_share

# share_helpers.py
#
# Copyright (C) 2016-2017 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2





def login_and_share(file_path, title, app_name):
    """ Make a share to Kano World. If the user is not logged in, present the
    register/login window to the user.

    :param file_path: Code file to be uploaded to Kano World
    :type file_path: str

    :param title: Title for the share
    :type title: str

    :param app_name: App making the share
    :type app_name: str

    :returns: Success, error message or None
    :rtype: Tuple of (bool, str)
    """

    success, unused = login_using_token()