

define gallery_unlocker_code = "mystash"

default gallery_unlocker_after_enter = ""
define gallery_unlocker_input_value = ""
define _gallery_unlocker_input_value = VariableInputValue("gallery_unlocker_input_value")

init python:
    def gallery_code_check():
        global gallery_unlocker_input_value
        global gallery_unlocker_after_enter
        gallery_unlocker_after_enter = gallery_unlocker_input_value
        if str(gallery_unlocker_after_enter).lower()!=str(gallery_unlocker_code).lower():
            renpy.show_screen("ez_message", "{color=#ff0000}Invalid{/color} code")
        else:
            gallery_unlocker_input_value = ""
            renpy.show_screen("ez_message", "Gallery {color=#04ff00}unlocked{/color}")
        return

screen phone_gallery_list_screen():
    tag phone
    modal True



    use phone_bg(do_anim=False)
    add "gui/phone_gallery_background.png"

    text _("Gallery") xalign 0.5 ypos 120 size 25 color "#000"

    if str(gallery_unlocker_after_enter).lower()!=str(gallery_unlocker_code).lower() and not isPlayingOnSteam():
        add "gui/padlock.png" xalign 0.5 yalign 0.22 xysize (120, 120) alpha 0.7
        text _("Insert the code:") xalign 0.5 yalign 0.38 size 35 color "#000"
        frame:
            xalign 0.5
            yalign 0.45
            xsize 420
            input id "input" pixel_width 370 xpos 10 yalign 0.5 copypaste True value _gallery_unlocker_input_value
        textbutton _("Enter") text_size 45 action Function(gallery_code_check) xalign 0.5 yalign 0.52 text_outlines [ (absolute(1), "#000", absolute(0), absolute(0)) ] keysym "input_enter" text_font gui.interface_text_font
        if not isPlayingOnSteam():
            text _("Don't you have the code?") xalign 0.5 yalign 0.65 outlines [ (absolute(1), "#000", absolute(0), absolute(0)) ]
            hbox:
                xalign 0.5
                yalign 0.7
                add "gui/patreon.webp" xysize (40, 40) yalign 0.62
                textbutton _("Get it now!"):
                    text_idle_color "#F96854"
                    text_size 45
                    yalign 0.5
                    text_outlines [ (absolute(1), "#000", absolute(0), absolute(0)) ]
                    action OpenURL("https://www.patreon.com/mybimbodream")
                    text_font gui.interface_text_font
    else:
        vpgrid xysize (450, 735) xalign 0.5 ypos 165 draggable True mousewheel True cols 2 spacing 10:
            use phone_gallery_list_screen_button(_("Camera"), PhoneManager.get_instance().gallery_entries[::-1])
            $ all_gallery_entries = []+PhoneManager.get_instance().gallery_entries[::-1]
            for profile in PhoneManager.get_instance().get_chat_list_profiles():
                for message in PhoneManager.get_instance().get_chat_profile_messages(profile.id)[::-1]:
                    if message.photo_big is not None:
                        $ all_gallery_entries.append(message.photo_big)
            use phone_gallery_list_screen_button(_("All"), all_gallery_entries)
            for profile in PhoneManager.get_instance().get_chat_list_profiles():
                $ current_pictures_vec = [message.photo_big for message in PhoneManager.get_instance().get_chat_profile_messages(profile.id) if message.photo_big is not None][::-1]
                if len(current_pictures_vec)>0:
                    use phone_gallery_list_screen_button(str(profile.name)+" "+__("chat"), current_pictures_vec)


    imagebutton xalign 0.5 ypos 900 idle "gui/button/phone_home_idle.png" action Show("phone_home_screen", None, False)

screen phone_gallery_list_screen_button(name, pics=[]):
    frame:
        xysize (220, 220)
        if pics and pics[0]:
            $ to_del = renpy.render(Transform(pics[0]), config.screen_width, config.screen_height, 0, 0)
            $ to_del_x, to_del_y = to_del.get_size()
        imagebutton:
            if not pics or not pics[0]:
                idle Transform("gui/empty.png", xsize = 210, ysize = 210, alpha = 0.4)
            else:
                if to_del_y > to_del_x:
                    idle Transform(Transform(pics[0], xsize = 210, fit = "contain"), alpha = 1.0, crop = (0, 0, 210, 210))
                    hover Transform(Transform(pics[0], xsize = 210, fit = "contain"), alpha = 1.0, crop = (0, 0, 210, 210))
                else:
                    idle Transform(Transform(pics[0], ysize = 210, fit = "contain"), alpha = 1.0, crop = (int(to_del_x * ( 210 / to_del_y ) / 2 - 210 / 2), 0, 210, 210))
                    hover Transform(Transform(pics[0], ysize = 210, fit = "contain"), alpha = 1.0, crop = (int(to_del_x * ( 210 / to_del_y ) / 2 - 210 / 2), 0, 210, 210))
                action Show("phone_gallery_room_screen", None, str(name), pics)
            align (0.5, 0.5)
        if pics and pics[0]:
            $ del to_del_x
            $ del to_del_y
            $ del to_del
        vbox:
            align (0.5, 0.5)
            text name align (0.5, 0.5)
            text "("+str(len(pics))+")" xalign 0.5
return
# Decompiled by unrpyc: https://github.com/CensoredUsername/unrpyc
