Skip to content

Commit

Permalink
Merge pull request #3 from messengerblack/auto-lightdark-fix
Browse files Browse the repository at this point in the history
Fixed a bug where text inside chat bubbles became invisible under certain circumstances.
  • Loading branch information
ryanmohta authored Aug 11, 2021
2 parents 04b5ad3 + 5d04ed8 commit b04f237
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 983 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
xcuserdata/
.DS_Store
dist
package-lock.json
2 changes: 1 addition & 1 deletion Messenger Black for Safari/.npmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
registry=https://npm.pkg.github.com/messengerblack
@messengerblack:registry=https://npm.pkg.github.com
7 changes: 4 additions & 3 deletions Messenger Black for Safari/SafariExtensionViewController.xib
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="18122" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="18122"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand Down Expand Up @@ -34,7 +35,7 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" selectable="YES" alignment="center" id="Ut4-iI-2O9">
<font key="font" metaFont="system" size="10"/>
<string key="title">Copyright © 2018-2019 Ryan Mohta.
<string key="title">Copyright © 2018-2021 Ryan Mohta.
All rights reserved.</string>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" white="1" alpha="0.79607234589041098" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
Expand Down
961 changes: 0 additions & 961 deletions Messenger Black for Safari/package-lock.json

This file was deleted.

8 changes: 4 additions & 4 deletions Messenger Black for Safari/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"author": "",
"license": "ISC",
"dependencies": {
"@messengerblack/messengerblack-css": "1.1.0",
"suncalc": "^1.8.0",
"webpack": "^5.11.0",
"webpack-cli": "^4.3.0"
"@messengerblack/messengerblack-css": "^1.2",
"suncalc": "^1.8",
"webpack": "^5.50",
"webpack-cli": "^4.7"
}
}
20 changes: 14 additions & 6 deletions Messenger Black for Safari/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ function handleMessage(event) {
function manualChanged(event) {

if(event.message["State"] === "On") {
document.documentElement.classList.add("__fb-dark-mode");
enableDarkMode();
}
else {
document.documentElement.classList.remove("__fb-dark-mode");
disableDarkMode();
}

clearInterval(timerVariable);
Expand Down Expand Up @@ -73,22 +73,30 @@ function scheduledTimer(startTimeHour, startTimeMinute, endTimeHour, endTimeMinu
if(endTimeHour < startTimeHour || (endTimeHour == startTimeHour && endTimeMinute < startTimeMinute)) {

if(currentHour < endTimeHour || (currentHour == endTimeHour && currentMinute < endTimeMinute) || (currentHour == startTimeHour && currentMinute >= startTimeMinute) || currentHour > startTimeHour) {
document.documentElement.classList.add("__fb-dark-mode");
enableDarkMode();
}
else {
document.documentElement.classList.remove("__fb-dark-mode");
disableDarkMode();
}

}
else {

if((currentHour > startTimeHour || (currentHour == startTimeHour && currentMinute >= startTimeMinute)) && ((currentHour == endTimeHour && currentMinute < endTimeMinute) || currentHour < endTimeHour)) {
document.documentElement.classList.add("__fb-dark-mode");
enableDarkMode();
}
else {
document.documentElement.classList.remove("__fb-dark-mode");
disableDarkMode();
}

}

}

function enableDarkMode() {
document.documentElement.classList.add("__fb-dark-mode");
}

function disableDarkMode() {
document.documentElement.classList.remove("__fb-dark-mode");
}
16 changes: 8 additions & 8 deletions Messenger Black.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -431,14 +431,14 @@
CODE_SIGN_ENTITLEMENTS = "Messenger Black/Messenger Black.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 13;
CURRENT_PROJECT_VERSION = 14;
DEVELOPMENT_TEAM = XX2UC95MTQ;
INFOPLIST_FILE = "Messenger Black/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 1.3.1;
MARKETING_VERSION = 1.3.2;
PRODUCT_BUNDLE_IDENTIFIER = "com.ryanmohta.Messenger-Black";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand All @@ -453,14 +453,14 @@
CODE_SIGN_ENTITLEMENTS = "Messenger Black/Messenger Black.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 13;
CURRENT_PROJECT_VERSION = 14;
DEVELOPMENT_TEAM = XX2UC95MTQ;
INFOPLIST_FILE = "Messenger Black/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 1.3.1;
MARKETING_VERSION = 1.3.2;
PRODUCT_BUNDLE_IDENTIFIER = "com.ryanmohta.Messenger-Black";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand All @@ -472,15 +472,15 @@
buildSettings = {
CODE_SIGN_ENTITLEMENTS = "Messenger Black for Safari/Messenger Black for Safari.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 13;
CURRENT_PROJECT_VERSION = 14;
DEVELOPMENT_TEAM = XX2UC95MTQ;
INFOPLIST_FILE = "Messenger Black for Safari/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@executable_path/../../../../Frameworks",
);
MARKETING_VERSION = 1.3.1;
MARKETING_VERSION = 1.3.2;
PRODUCT_BUNDLE_IDENTIFIER = "com.ryanmohta.Messenger-Black.Messenger-Black-for-Safari";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
Expand All @@ -493,15 +493,15 @@
buildSettings = {
CODE_SIGN_ENTITLEMENTS = "Messenger Black for Safari/Messenger Black for Safari.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 13;
CURRENT_PROJECT_VERSION = 14;
DEVELOPMENT_TEAM = XX2UC95MTQ;
INFOPLIST_FILE = "Messenger Black for Safari/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@executable_path/../../../../Frameworks",
);
MARKETING_VERSION = 1.3.1;
MARKETING_VERSION = 1.3.2;
PRODUCT_BUNDLE_IDENTIFIER = "com.ryanmohta.Messenger-Black.Messenger-Black-for-Safari";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
Expand Down

0 comments on commit b04f237

Please sign in to comment.