From 2c3a963304a59b0427f68272826f61febb875ac0 Mon Sep 17 00:00:00 2001 From: Eduardo Asafe Date: Tue, 9 Jul 2024 15:25:45 -0300 Subject: [PATCH] Request permission --- src/Client/Common/Dom.js | 1 + src/Client/Common/Dom.purs | 4 ++-- src/Client/Im/Main.purs | 11 ++--------- src/Server/3000/Data.purs | 6 +++--- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/Client/Common/Dom.js b/src/Client/Common/Dom.js index a1d232eb..69e65368 100644 --- a/src/Client/Common/Dom.js +++ b/src/Client/Common/Dom.js @@ -19,6 +19,7 @@ export function customEventDetail_(event) { } export function mediaMatches_(displayMode) { + console.log(displayMode, window.matchMedia('(display-mode: ' + displayMode + ')').matches); return window.matchMedia('(display-mode: ' + displayMode + ')').matches; } diff --git a/src/Client/Common/Dom.purs b/src/Client/Common/Dom.purs index e4d3fe46..fe2ca37b 100644 --- a/src/Client/Common/Dom.purs +++ b/src/Client/Common/Dom.purs @@ -60,9 +60,9 @@ foreign import notificationPermission ∷ Effect String foreign import scrollIntoView_ ∷ EffectFn1 Element Unit -foreign import mediaMatches_ :: EffectFn1 String Boolean +foreign import mediaMatches_ ∷ EffectFn1 String Boolean -mediaMatches :: String -> Effect Boolean +mediaMatches ∷ String → Effect Boolean mediaMatches = EU.runEffectFn1 mediaMatches_ setChatExperiment ∷ EventType diff --git a/src/Client/Im/Main.purs b/src/Client/Im/Main.purs index 662eb29e..bdbc5685 100644 --- a/src/Client/Im/Main.purs +++ b/src/Client/Im/Main.purs @@ -129,7 +129,6 @@ main = do --harass temporary users on their last day to make an account FS.send imId CheckUserExpiration - update ∷ _ → ListUpdate ImModel ImMessage update { webSocketRef, fileReader } model = case _ of @@ -732,20 +731,14 @@ toggleConnectedWebSocket isConnected model@{ hasTriedToConnectYet, errorMessage preventStop ∷ Event → ImModel → NextMessage preventStop event model = CIF.nothingNext model <<< liftEffect $ CCD.preventStop event -checkMobileNotifications :: Effect Unit +checkMobileNotifications ∷ Effect Unit checkMobileNotifications = do status ← CCD.notificationPermission when (status == "default") do --check if we are running as pwa instead of a web page - matches <- DT.traverse CCD.mediaMatches ["fullscreen", "standalone", "minimal-ui"] + matches ← DT.traverse CCD.mediaMatches [ "fullscreen", "standalone", "minimal-ui" ] when (DT.or matches) CCD.requestNotificationPermission - -- function isPwa() { --- return [].some( --- (displayMode) => window.matchMedia().matches --- ); --- } - checkDesktopNotifications ∷ Effect Unit checkDesktopNotifications = do status ← CCD.notificationPermission diff --git a/src/Server/3000/Data.purs b/src/Server/3000/Data.purs index 27ff17e8..7c480c59 100644 --- a/src/Server/3000/Data.purs +++ b/src/Server/3000/Data.purs @@ -71,7 +71,7 @@ grammaticalClasses = , Tuple 11 [ "Observation", "Housekeeper", "Floorwalker", "Development", "Guinea Fowl", "Caterpillar", "Nightingale", "Firefighter", "Prairie Dog", "Hummingbird", "Stegosaurus", "Competition", "Flesh Eater", "Grasshopper", "Destruction", "Sand Dollar", "Giant Panda", "Electrician", "Entertainer", "Salesperson", "Saxophonist", "Scuba Diver", "Stockbroker", "Xylophonist" ] , Tuple 12 [ "Choir Member", "Distribution", "Faith Healer", "Spokesperson", "Superstition", "Afterthought", "Sharpshooter", "Organization", "Entomologist", "Entrepreneur", "Exterminator", "Calligrapher", "Cardiologist", "Cartographer", "Mail Carrier", "Manufacturer", "Statistician", "Veterinarian" ] , Tuple 3 [ "Box", "God", "Wax", "Yak", "Tax", "Cub", "Pen", "Ice", "Net", "Can", "Art", "Ray", "Cod", "Zoo", "Ant", "Gnu", "Cap", "Pig", "Rat", "Van", "Jar", "Emu", "Arm", "Fan", "Key", "Dog", "Spy", "Gun", "Lip", "Ape", "Bed", "Ram", "Pot", "Ear", "Cup", "Leg", "War", "Rod", "Run", "Air", "Egg", "Map", "Ink", "Day", "Pet", "Sky", "Eel", "Eye", "Use", "Toy", "Act", "Tub", "Sea", "Top", "Hat", "Tin", "Fog", "Jam", "Low", "Elk", "Bat", "Owl", "Jay", "Car", "Pan", "Cry", "Hen", "Sun", "Pie", "Way", "Cat", "Pin", "Yam", "Toe", "Bun", "Bee", "Oil", "Bit", "End", "Fly", "Fox", "One" ] - , Tuple 7 [ "Termite", "Buffalo", "Thought", "Produce", "Popcorn", "Dogfish", "Manatee", "Dolphin", "Chicken", "Process", "Vicuña", "Request", "Panther", "Opinion", "Feeling", "Lookout", "Control", "Payment", "Insurer", "Opossum", "Partner", "Contact", "Library", "Raccoon", "Pelican", "Sweater", "Cabbage", "Aviator", "Lapwing", "Oatmeal", "Narwhal", "Reading", "Mailbox", "Ostrich", "Officer", "Hydrant", "Disease", "Example", "History", "Hamster", "Airport", "Student", "Quarter", "Visitor", "Disgust", "Purpose", "Stretch", "Guanaco", "Haircut", "Creator", "Driving", "Gorilla", "Whistle", "Attempt", "Goshawk", "Lettuce", "Manager", "Curtain", "Caribou", "Cleaner", "Picture", "Railway", "Gazelle", "Harmony", "Octopus", "Fiction", "Tarsier", "Holiday", "Account", "Achieve", "Echidna", "Volcano", "Mammoth", "Current", "Sardine", "Thunder", "Pancake", "Brother", "Country", "Respect", "Impulse", "Morning", "Peafowl", "Giraffe", "Leopard", "Caption", "Trouble", "Balance", "Lobster", "Wallaby", "Apparel", "Stomach", "Balloon", "Comfort", "Cushion", "Company", "Penguin", "Hearing", "Meeting", "Bedroom", "Flagger", "Fighter", "Feather", "Artisan", "Station", "Science", "Hobbies", "Measure", "Channel", "Receipt", "Protest", "Writing", "Support", "Soldier", "Cheetah", "Texture", "Herring", "Journey", "Cowhand", "Laborer", "Machine", "Society", "Mallard", "Believe", "Scholar", "Weather", "Leather", "Plastic", "Insider", "Ladybug", "Quetzal", "Empress", "Emperor", "Captain", "Cashier", "Catcher", "Caterer", "Cellist", "Chemist", "Cobbler", "Courier", "Samurai", "Senator", "Surgeon", "Swimmer", "Veteran", "Athlete" ] + , Tuple 7 [ "Termite", "Buffalo", "Thought", "Produce", "Popcorn", "Dogfish", "Manatee", "Dolphin", "Chicken", "Process", "Vicuña", "Request", "Panther", "Opinion", "Feeling", "Lookout", "Control", "Payment", "Insurer", "Opossum", "Partner", "Contact", "Library", "Raccoon", "Pelican", "Sweater", "Cabbage", "Aviator", "Lapwing", "Oatmeal", "Narwhal", "Reading", "Mailbox", "Ostrich", "Officer", "Hydrant", "Disease", "Example", "History", "Hamster", "Airport", "Student", "Quarter", "Visitor", "Purpose", "Stretch", "Guanaco", "Haircut", "Creator", "Driving", "Gorilla", "Whistle", "Attempt", "Goshawk", "Lettuce", "Manager", "Curtain", "Caribou", "Cleaner", "Picture", "Railway", "Gazelle", "Harmony", "Octopus", "Fiction", "Tarsier", "Holiday", "Account", "Achieve", "Echidna", "Volcano", "Mammoth", "Current", "Sardine", "Thunder", "Pancake", "Brother", "Country", "Respect", "Impulse", "Morning", "Peafowl", "Giraffe", "Leopard", "Caption", "Trouble", "Balance", "Lobster", "Wallaby", "Apparel", "Stomach", "Balloon", "Comfort", "Cushion", "Company", "Penguin", "Hearing", "Meeting", "Bedroom", "Flagger", "Fighter", "Feather", "Artisan", "Station", "Science", "Hobbies", "Measure", "Channel", "Receipt", "Protest", "Writing", "Support", "Soldier", "Cheetah", "Texture", "Herring", "Journey", "Cowhand", "Laborer", "Machine", "Society", "Mallard", "Believe", "Scholar", "Weather", "Leather", "Plastic", "Insider", "Ladybug", "Quetzal", "Empress", "Emperor", "Captain", "Cashier", "Catcher", "Caterer", "Cellist", "Chemist", "Cobbler", "Courier", "Samurai", "Senator", "Surgeon", "Swimmer", "Veteran", "Athlete" ] ] , Tuple Adjective $ HM.fromArray [ Tuple 8 [ "Grateful", "Strident", "Vigilant", "Thorough", "Splendid", "Grounded", "Attached", "Academic", "Adorable", "Metallic", "Granular", "Trusting", "Exciting", "Possible", "Ordinary", "Nautical", "Gruesome", "Thankful", "Creative", "Absolute", "Shocking", "Well-lit", "Colossal", "Jubilant", "Innocent", "Gracious", "Idolized", "Charming", "Confused", "Alarming", "Artistic", "Composed", "Anchored", "Unsteady", "Lustrous", "Majestic", "Decisive", "Precious", "Suburban", "Informal", "Distinct", "Familiar", "Advanced", "Scratchy", "Haunting", "Cheerful", "Critical", "Gleaming", "Agitated", "Careless", "Squiggly", "Impolite", "Cultured", "Fabulous", "Indolent", "Finished", "Writhing", "Striking", "Fearless", "Trifling", "Harmless", "Punctual", "Terrible", "Clueless", "Euphoric", "Favorite", "Fatherly", "Educated", "Positive", "Obedient", "Ironclad", "Friendly", "Gigantic", "Vigorous", "Vengeful", "Reckless", "Carefree", "Truthful", "Terrific", "Negative", "Horrible", "Quixotic", "Tempting", "Infamous", "Well-off", "Discrete", "Bustling", "Tattered", "Definite", "Wretched", "Straight", "Motherly", "Blushing", "Circular", "Detailed", "Pleasant", "Pristine", "Gripping", "Studious", "Intrepid", "Lopsided", "Physical", "Whopping", "Reliable", "Precious", "Internal", "Infinite", "Growling", "Pleasing", "Uncommon", "Spotless", "Constant", "Variable", "Standard", "Ecstatic", "Sardonic", "Flawless", "Fruitful", "Deserted", "Untimely", "Sociable", "Puzzling", "Snarling", "Dazzling", "Forsaken", "Helpless", "Generous", "Unwieldy", "Concrete", "Valuable", "Animated", "Original", "Utilized", "Blissful", "Mindless", "Grizzled", "Outlying", "Polished", "Cautious", "Required", "Handmade", "Aromatic", "Watchful", "Gullible", "Unfolded", "Glorious", "Rotating", "Specific", "Esteemed", "Stunning", "Relieved", "Wrathful", "Peaceful", "Faithful", "Menacing", "Spiteful", "Accurate", "Crushing", "Troubled", "Complete", "Perfumed", "Personal", "Graceful", "Powerful", "Colorful", "Criminal", "Separate", "Periodic", "Heavenly", "Disloyal", "Slippery", "Skeletal", "Electric", "Probable", "Parallel", "Luminous", "Spirited", "Previous", "Frequent", "Sizzling", "Outgoing", "Superior", "Dramatic", "Scornful", "Flippant", "Adorable", "Unlawful", "Tangible", "Diligent", "Fragrant", "Youthful", "Juvenile", "Forceful", "Ultimate", "Fumbling", "Athletic", "Official", "Gorgeous", "Insecure", "Virtuous" ] @@ -85,7 +85,7 @@ grammaticalClasses = , Tuple 14 [ "Quintessential", "Happy-go-lucky", "Impressionable" ] , Tuple 3 [ "All", "Red", "Tan", "Dim", "Wee", "New", "Key", "Few", "Shy", "Far", "Bad", "Wry", "Icy", "Apt", "Our", "Dry", "Mad", "Sad", "Any", "Low", "Wet", "Hot", "Wan", "Odd", "Old" ] , Tuple 7 [ "Unknown", "Eminent", "Welcome", "Foolish", "Optimal", "Limited", "Likable", "Scrawny", "Spotted", "Angelic", "Crooked", "Yawning", "Pungent", "Jealous", "Damaged", "Decimal", "Mundane", "Puzzled", "Pointed", "Mammoth", "Devoted", "Admired", "Ashamed", "Subdued", "Enraged", "Amusing", "Austere", "Soulful", "Belated", "Scented", "Envious", "Genuine", "Untried", "Unaware", "Complex", "Natural", "Delayed", "Antique", "Unlined", "Stained", "Buzzing", "Overdue", "Prudent", "Radiant", "Helpful", "Unusual", "Fitting", "Violent", "Unlucky", "Roasted", "Stylish", "Assured", "Lovable", "Regular", "Knowing", "Rubbery", "Babyish", "Immense", "Profuse", "Present", "Potable", "Healthy", "Shallow", "Careful", "Plastic", "Trained", "Growing", "Popular", "Gleeful", "Warlike", "Leading", "Alarmed", "Fearful", "Failing", "Focused", "Wealthy", "Miserly", "Noxious", "Jittery", "Elderly", "Idiotic", "Nervous", "Glaring", "Distant", "Peppery", "Nonstop", "Muffled", "Pleased", "Faraway", "Dearest", "Orderly", "Thrifty", "General", "Amazing", "Visible", "Oddball", "Opulent", "Shadowy", "Private", "Darling", "Vibrant", "Lasting", "Harmful", "Notable", "Medical", "Vicious", "Unhappy", "Content", "Made-up", "Elastic", "Organic", "Exalted", "Dutiful", "Grouchy", "Strange", "Illegal", "Blaring", "Boiling", "Zealous", "Shocked", "Perfect", "Humming", "Dimpled", "Playful", "Honored", "Ancient", "Awesome", "Velvety", "Virtual", "Parched", "Partial", "Teeming", "Far-off", "Buttery", "Awkward", "Classic", "Elegant", "Useless", "Serious", "Average", "Tedious", "Weighty", "Worldly", "Similar", "Obvious", "Offbeat", "Bruised", "Defiant", "Hopeful", "Ethical", "Starchy", "Earnest", "Uniform", "Worried", "Digital", "Crowded", "Trivial", "Capital", "Melodic", "Willing", "Beloved", "Another", "Winding", "Monthly", "Primary", "Distant", "Flowery", "Spanish" ] - , Tuple 10 [ "Delectable", "Overcooked", "Frightened", "Unfinished", "Well-to-do", "Definitive", "Reflecting", "Easy-going", "Impressive", "Determined", "Unpleasant", "Tremendous", "Reasonable", "Sweltering", "Glistening", "Remarkable", "Optimistic", "Motionless", "Noteworthy", "Disastrous", "Remorseful", "Altruistic", "Immaterial", "Authorized", "Legitimate", "Respectful", "Profitable", "Impossible", "Bite-sized", "Glittering", "Scientific", "Avaricious", "Supportive", "Worthwhile", "Victorious", "Acceptable", "Thoughtful", "Thunderous", "Improbable", "Extraneous", "Overlooked", "Short-term", "Passionate", "Enchanting", "Elementary", "Jam-packed", "High-level", "Villainous", "Suspicious", "Beneficial", "Negligible", "Nutritious", "Delightful", "Forthright", "Monumental", "Occasional", "Simplistic", "Stupendous", "Harmonious", "Outrageous", "Tremendous", "Courageous", "Threadbare", "Burdensome", "Cultivated", "Cumbersome", "Elliptical", "Triangular", "Dependable", "Mysterious", "Shimmering", "Outlandish", "Infatuated", "Gregarious", "Incomplete", "Idealistic", "Disgusting", "Flickering", "Productive", "Immaculate", "Functional", "Incredible", "Impeccable", "Hospitable", "Equatorial", "Verifiable", "Serpentine", "Aggressive", "Gargantuan", "Celebrated" ] + , Tuple 10 [ "Delectable", "Overcooked", "Frightened", "Unfinished", "Well-to-do", "Definitive", "Reflecting", "Easy-going", "Impressive", "Determined", "Unpleasant", "Tremendous", "Reasonable", "Sweltering", "Glistening", "Remarkable", "Optimistic", "Motionless", "Noteworthy", "Disastrous", "Remorseful", "Altruistic", "Immaterial", "Authorized", "Legitimate", "Respectful", "Profitable", "Impossible", "Bite-sized", "Glittering", "Scientific", "Avaricious", "Supportive", "Worthwhile", "Victorious", "Acceptable", "Thoughtful", "Thunderous", "Improbable", "Extraneous", "Overlooked", "Short-term", "Passionate", "Enchanting", "Elementary", "Jam-packed", "High-level", "Villainous", "Suspicious", "Beneficial", "Negligible", "Nutritious", "Delightful", "Forthright", "Monumental", "Occasional", "Simplistic", "Stupendous", "Harmonious", "Outrageous", "Tremendous", "Courageous", "Threadbare", "Burdensome", "Cultivated", "Cumbersome", "Elliptical", "Triangular", "Dependable", "Mysterious", "Shimmering", "Outlandish", "Infatuated", "Gregarious", "Incomplete", "Idealistic", "Flickering", "Productive", "Immaculate", "Functional", "Incredible", "Impeccable", "Hospitable", "Equatorial", "Verifiable", "Serpentine", "Aggressive", "Gargantuan", "Celebrated" ] , Tuple 15 [ "Well-documented", "Black-and-white", "Inconsequential" ] ] , Tuple Adverb $ HM.fromArray @@ -106,7 +106,7 @@ grammaticalClasses = ] , Tuple PluralNoun $ HM.fromArray [ Tuple 11 [ "Comparisons", "Cassowaries", "Toothpastes", "Salamanders", "Polar Bears", "Plantations", "Goldfinches", "Volleyballs", "Playgrounds", "Experiences", "Fellowships", "Butterflies", "Chinchillas", "Arithmetics", "Suggestions", "Earthquakes", "Basketballs", "Calculators", "Sea Urchins", "Punishments", "Secretaries", "Albatrosses", "Attractions", "Connections", "Apparatuses", "Jellyfishes", "Discussions", "Instruments", "Adjustments", "Guinea Pigs", "Authorities", "Territories", "Compatriots", "Chimpanzees", "Governments", "Dragonflies", "Discoveries", "Cab Drivers", "Cartoonists", "Contractors", "Salespeople", "Ambassadors", "Astronomers", "Auctioneers", "Undertakers" ] - , Tuple 8 [ "Termites", "Thoughts", "Produces", "Popcorns", "Manatees", "Dolphins", "Chickens", "Vicuñas", "Requests", "Panthers", "Opinions", "Feelings", "Lookouts", "Controls", "Payments", "Potatoes", "Insurers", "Quartzes", "Opossums", "Partners", "Contacts", "Raccoons", "Sweaters", "Cabbages", "Aviators", "Stitches", "Lapwings", "Oatmeals", "Memories", "Narwhals", "Readings", "Recesses", "Hydrants", "Diseases", "Examples", "Hamsters", "Airports", "Students", "Quarters", "Visitors", "Disgusts", "Canvases", "Purposes", "Haircuts", "Churches", "Creators", "Drivings", "Gorillas", "Whistles", "Attempts", "Cactuses", "Goshawks", "Lettuces", "Managers", "Curtains", "Caribous", "Polishes", "Cleaners", "Pictures", "Railways", "Gazelles", "Fictions", "Tarsiers", "Holidays", "Accounts", "Achieves", "Echidnas", "Mammoths", "Currents", "Sardines", "Thunders", "Pancakes", "Brothers", "Theories", "Cherries", "Respects", "Impulses", "Mornings", "Peafowls", "Giraffes", "Leopards", "Captions", "Troubles", "Balances", "Shooters", "Lobsters", "Apparels", "Balloons", "Comforts", "Cushions", "Penguins", "Hearings", "Meetings", "Bedrooms", "Branches", "Flaggers", "Fighters", "Feathers", "Artisans", "Stations", "Sciences", "Measures", "Channels", "Receipts", "Protests", "Writings", "Supports", "Soldiers", "Celeries", "Wrenches", "Cheetahs", "Textures", "Herrings", "Journeys", "Cowhands", "Laborers", "Machines", "Mallards", "Believes", "Scholars", "Weathers", "Leathers", "Plastics", "Insiders", "Ladybugs", "Quetzals", "Emperors", "Captains", "Cashiers", "Catchers", "Caterers", "Cellists", "Chemists", "Cobblers", "Coroners", "Couriers", "Samurais", "Senators", "Sweepers", "Surgeons", "Swimmers", "Veterans", "Athletes" ] + , Tuple 8 [ "Termites", "Thoughts", "Produces", "Popcorns", "Manatees", "Dolphins", "Chickens", "Vicuñas", "Requests", "Panthers", "Opinions", "Feelings", "Lookouts", "Controls", "Payments", "Potatoes", "Insurers", "Quartzes", "Opossums", "Partners", "Contacts", "Raccoons", "Sweaters", "Cabbages", "Aviators", "Stitches", "Lapwings", "Oatmeals", "Memories", "Narwhals", "Readings", "Recesses", "Hydrants", "Diseases", "Examples", "Hamsters", "Airports", "Students", "Quarters", "Visitors", "Canvases", "Purposes", "Haircuts", "Churches", "Creators", "Drivings", "Gorillas", "Whistles", "Attempts", "Cactuses", "Goshawks", "Lettuces", "Managers", "Curtains", "Caribous", "Polishes", "Cleaners", "Pictures", "Railways", "Gazelles", "Fictions", "Tarsiers", "Holidays", "Accounts", "Achieves", "Echidnas", "Mammoths", "Currents", "Sardines", "Thunders", "Pancakes", "Brothers", "Theories", "Cherries", "Respects", "Impulses", "Mornings", "Peafowls", "Giraffes", "Leopards", "Captions", "Troubles", "Balances", "Shooters", "Lobsters", "Apparels", "Balloons", "Comforts", "Cushions", "Penguins", "Hearings", "Meetings", "Bedrooms", "Branches", "Flaggers", "Fighters", "Feathers", "Artisans", "Stations", "Sciences", "Measures", "Channels", "Receipts", "Protests", "Writings", "Supports", "Soldiers", "Celeries", "Wrenches", "Cheetahs", "Textures", "Herrings", "Journeys", "Cowhands", "Laborers", "Machines", "Mallards", "Believes", "Scholars", "Weathers", "Leathers", "Plastics", "Insiders", "Ladybugs", "Quetzals", "Emperors", "Captains", "Cashiers", "Catchers", "Caterers", "Cellists", "Chemists", "Cobblers", "Coroners", "Couriers", "Samurais", "Senators", "Sweepers", "Surgeons", "Swimmers", "Veterans", "Athletes" ] , Tuple 4 [ "Gods", "Yaks", "Cubs", "Ices", "Nets", "Cans", "Arts", "Rays", "Cods", "Zoos", "Ants", "Gnus", "Caps", "Pigs", "Vans", "Jars", "Hots", "Emus", "Arms", "Fans", "Keys", "Dogs", "Lips", "Apes", "Beds", "Rams", "Pots", "Ears", "Cups", "Legs", "Wars", "Rods", "Runs", "Airs", "Eggs", "Maps", "Inks", "Days", "Pets", "Eels", "Eyes", "Uses", "Acts", "Tubs", "Seas", "Hats", "Tins", "Fogs", "Jams", "Lows", "Elks", "Bats", "Owls", "Jays", "Cars", "Pans", "Hens", "Suns", "Pies", "Ways", "Cats", "Pins", "Yams", "Toes", "Buns", "Bees", "Oils", "Bits", "Ends", "Ones" ] , Tuple 13 [ "Choir Members", "Distributions", "Faith Healers", "Superstitions", "Water Buffalo", "Stegosauruses", "Afterthoughts", "Organizations", "Entomologists", "Entrepreneurs", "Exterminators", "Calligraphers", "Cardiologists", "Cartographers", "Mail Carriers", "Manufacturers", "Statisticians", "Veterinarians" ] , Tuple 15 [ "Representatives", "Press Operators", "Security Guards", "Business people" ]