Skip to content

Commit

Permalink
Selenium v1.2.1
Browse files Browse the repository at this point in the history
Disabled location features and scripts
  • Loading branch information
lgariv authored Oct 17, 2021
2 parents 2ce614d + 8f3c677 commit 53412bc
Show file tree
Hide file tree
Showing 6 changed files with 173 additions and 154 deletions.
22 changes: 11 additions & 11 deletions Tweak/Tweak.xm
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ BOOL snooozedDeliverProminently;
static NSInteger segmentInterval;
static NSInteger chosenButton;
static BOOL deliverQuietlyWhilePlaying;
static BOOL snoozeByLocationEnabled;
static BOOL snoozeByLocationEnabled = NO;
PCSimpleTimer *lastTimer;

NSDictionary *prefs = nil;
Expand Down Expand Up @@ -2764,17 +2764,17 @@ static void loadPrefs() {
segmentInterval = [[prefs objectForKey:@"segmentInterval"] intValue];
chosenButton = [[prefs objectForKey:@"chosenButton"] intValue];
deliverQuietlyWhilePlaying = [[prefs objectForKey:@"deliverQuietlyWhilePlaying"] boolValue];
snoozeByLocationEnabled = [[prefs objectForKey:@"snoozeByLocation"] boolValue];
// snoozeByLocationEnabled = [[prefs objectForKey:@"snoozeByLocation"] boolValue];
if (deliverQuietlyWhilePlaying == YES) %init(deliverQuietly);
if (snoozeByLocationEnabled == YES) {
NSMutableArray *entries = [config[@"entries"] mutableCopy];
for (NSMutableDictionary *entry in entries) {
if ([entry[@"timeStamp"] doubleValue] == -2) {
NCNotificationRequest *expiredReq = entry[@"id"];
processEntry(expiredReq, 0, nil, nil, nil);
}
}
}
// if (snoozeByLocationEnabled != YES) {
// NSMutableArray *entries = [config[@"entries"] mutableCopy];
// for (NSMutableDictionary *entry in entries) {
// if ([entry[@"timeStamp"] doubleValue] == -2) {
// NCNotificationRequest *expiredReq = entry[@"id"];
// processEntry(expiredReq, 0, nil, nil, nil);
// }
// }
// }
}
}

Expand Down
5 changes: 2 additions & 3 deletions control
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Package: com.miwix.selenium
Name: Selenium
Depends: mobilesubstrate, ws.hbang.common, firmware (>= 13.0), com.bingner.plutil, sed
Pre-Depends: com.bingner.plutil, sed
Version: 1.2.0
Depends: mobilesubstrate, ws.hbang.common, firmware (>= 13.0)
Version: 1.2.1
Architecture: iphoneos-arm
Description: Snooze notifications. Focus on what matters⏱
Maintainer: Lavie Gariv
Expand Down
82 changes: 41 additions & 41 deletions layout/DEBIAN/postinst
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
#!/usr/bin/bash

echo "[Selenium] Setting permissions..."

FILE="/Library/Application Support/SeleniumExtra.bundle/Assets/icon.PNG"
if test -f "$FILE"; then
echo "[Selenium] Icon..."
chmod 0644 "/Library/Application Support/SeleniumExtra.bundle/Assets/icon.PNG"
fi

FILE="/Library/Application Support/SeleniumExtra.bundle/de.lproj/Localizable.strings"
if test -f "$FILE"; then
echo "[Selenium] German..."
chmod 0644 "/Library/Application Support/SeleniumExtra.bundle/de.lproj/Localizable.strings"
fi

FILE="/Library/Application Support/SeleniumExtra.bundle/en.lproj/Localizable.strings"
if test -f "$FILE"; then
echo "[Selenium] English..."
chmod 0644 "/Library/Application Support/SeleniumExtra.bundle/en.lproj/Localizable.strings"
fi

FILE="/Library/Application Support/SeleniumExtra.bundle/fr.lproj/Localizable.strings"
if test -f "$FILE"; then
echo "[Selenium] French..."
chmod 0644 "/Library/Application Support/SeleniumExtra.bundle/fr.lproj/Localizable.strings"
fi

FILE="/Library/Application Support/SeleniumExtra.bundle/he.lproj/Localizable.strings"
if test -f "$FILE"; then
echo "[Selenium] Hebrew..."
chmod 0644 "/Library/Application Support/SeleniumExtra.bundle/he.lproj/Localizable.strings"
fi

FILE="/System/Library/CoreServices/SpringBoard.app/Info.plist"
if test -f "$FILE"; then
echo "[Selenium] SpringBoard..."
chmod 0644 "/System/Library/CoreServices/SpringBoard.app/Info.plist"
fi

echo "[Selenium] Permissions set!"
#!/bin/bash

# echo "[Selenium] Setting permissions..."

# FILE="/Library/Application Support/SeleniumExtra.bundle/Assets/icon.PNG"
# if test -f "$FILE"; then
# echo "[Selenium] Icon..."
# chmod 0644 "/Library/Application Support/SeleniumExtra.bundle/Assets/icon.PNG"
# fi

# FILE="/Library/Application Support/SeleniumExtra.bundle/de.lproj/Localizable.strings"
# if test -f "$FILE"; then
# echo "[Selenium] German..."
# chmod 0644 "/Library/Application Support/SeleniumExtra.bundle/de.lproj/Localizable.strings"
# fi

# FILE="/Library/Application Support/SeleniumExtra.bundle/en.lproj/Localizable.strings"
# if test -f "$FILE"; then
# echo "[Selenium] English..."
# chmod 0644 "/Library/Application Support/SeleniumExtra.bundle/en.lproj/Localizable.strings"
# fi

# FILE="/Library/Application Support/SeleniumExtra.bundle/fr.lproj/Localizable.strings"
# if test -f "$FILE"; then
# echo "[Selenium] French..."
# chmod 0644 "/Library/Application Support/SeleniumExtra.bundle/fr.lproj/Localizable.strings"
# fi

# FILE="/Library/Application Support/SeleniumExtra.bundle/he.lproj/Localizable.strings"
# if test -f "$FILE"; then
# echo "[Selenium] Hebrew..."
# chmod 0644 "/Library/Application Support/SeleniumExtra.bundle/he.lproj/Localizable.strings"
# fi

# FILE="/System/Library/CoreServices/SpringBoard.app/Info.plist"
# if test -f "$FILE"; then
# echo "[Selenium] SpringBoard..."
# chmod 0644 "/System/Library/CoreServices/SpringBoard.app/Info.plist"
# fi

# echo "[Selenium] Permissions set!"
92 changes: 46 additions & 46 deletions layout/DEBIAN/postrm
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
#!/usr/bin/bash
#!/bin/bash

# Removing manager.plist

if [ "remove" == "$1" ]; then
echo "[Selenium] Removing files..."
FILE="/var/mobile/Library/Selenium/manager.plist"
if test -f "$FILE"; then
rm -r "/var/mobile/Library/Selenium/"
fi

echo "[Selenium] Restoring backup..."
BACKUP="/System/Library/CoreServices/SpringBoard.app/Info.plist.backup"
if test -f "$BACKUP"; then
rm /System/Library/CoreServices/SpringBoard.app/Info.plist
mv /System/Library/CoreServices/SpringBoard.app/Info.plist.backup /System/Library/CoreServices/SpringBoard.app/Info.plist
echo "[Selenium] Backup restored!"
fi
fi


# Aborting install/upgrade if preinst extied with an error

ABORT=0

case "$1" in
abort-install )
ABORT=1
#finish return
;;
abort-upgrade )
ABORT=1
#finish return
;;
failed-upgrade )
ABORT=1
#finish return
;;
esac

if [ $ABORT == 1 ]; then
echo "[Selenium] Aborting..."
BACKUP="/System/Library/CoreServices/SpringBoard.app/Info.plist.backup"
if test -f "$BACKUP"; then
rm /System/Library/CoreServices/SpringBoard.app/Info.plist
mv /System/Library/CoreServices/SpringBoard.app/Info.plist.backup /System/Library/CoreServices/SpringBoard.app/Info.plist
echo "[Selenium] An error occured during install. System modifications were reverted to original state."
fi
fi
# if [ "remove" == "$1" ]; then
# echo "[Selenium] Removing files..."
# FILE="/var/mobile/Library/Selenium/manager.plist"
# if test -f "$FILE"; then
# rm -r "/var/mobile/Library/Selenium/"
# fi

# echo "[Selenium] Restoring backup..."
# BACKUP="/System/Library/CoreServices/SpringBoard.app/Info.plist.backup"
# if test -f "$BACKUP"; then
# rm /System/Library/CoreServices/SpringBoard.app/Info.plist
# mv /System/Library/CoreServices/SpringBoard.app/Info.plist.backup /System/Library/CoreServices/SpringBoard.app/Info.plist
# echo "[Selenium] Backup restored!"
# fi
# fi


# # Aborting install/upgrade if preinst extied with an error

# ABORT=0

# case "$1" in
# abort-install )
# ABORT=1
# #finish return
# ;;
# abort-upgrade )
# ABORT=1
# #finish return
# ;;
# failed-upgrade )
# ABORT=1
# #finish return
# ;;
# esac

# if [ $ABORT == 1 ]; then
# echo "[Selenium] Aborting..."
# BACKUP="/System/Library/CoreServices/SpringBoard.app/Info.plist.backup"
# if test -f "$BACKUP"; then
# rm /System/Library/CoreServices/SpringBoard.app/Info.plist
# mv /System/Library/CoreServices/SpringBoard.app/Info.plist.backup /System/Library/CoreServices/SpringBoard.app/Info.plist
# echo "[Selenium] An error occured during install. System modifications were reverted to original state."
# fi
# fi
106 changes: 53 additions & 53 deletions layout/DEBIAN/preinst
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
#!/usr/bin/bash
#!/bin/bash

set -e
x=1
while [ $x -eq 1 ]
do
#ARG="install"
#if [ "$ARG" == "$1" ]; then
echo "[Selenium] Checking files..."
FILE="/Library/Application Support/SeleniumExtra.bundle/txt.txt"
if test -f "$FILE"; then
chmod 0644 "/Library/Application Support/SeleniumExtra.bundle/txt.txt"
fi
INFO="/System/Library/CoreServices/SpringBoard.app/Info.plist"
if test -f "$INFO"; then
BACKUP="/System/Library/CoreServices/SpringBoard.app/Info.plist.backup"
if test -f "$BACKUP"; then
echo "[Selenium] Backup exists!"
echo "[Selenium] Files already modified!"
else
echo "[Selenium] Backing up files..."
cp /System/Library/CoreServices/SpringBoard.app/Info.plist /System/Library/CoreServices/SpringBoard.app/Info.plist.backup && : || break
echo "[Selenium] Modifying files..."
plutil -convert xml1 $INFO > /dev/null 2>&1 && : || break
echo "[Selenium] Modifying files..."
LINES="$(wc -l $INFO | sed -n 's/ $INFO//gp' | sed -n 's/ //gp')"
echo "[Selenium] Modifying files..."
NEWLINES="$(echo "$((LINES - 2))")"
echo "[Selenium] Modifying files..."
echo "$(cat $INFO | head -n$NEWLINES)" > newInfo.plist && : || break
echo "[Selenium] Modifying files..."
echo " <key>UIBackgroundModes</key>" >> newInfo.plist && : || break
echo " <array>" >> newInfo.plist && : || break
echo " <string>location</string>" >> newInfo.plist && : || break
echo " </array>" >> newInfo.plist && : || break
echo " <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>" >> newInfo.plist && : || break
echo " <string>Set location access to 'Always' to enable location-based features for Selenium.</string>" >> newInfo.plist && : || break
echo " <key>NSLocationWhenInUseUsageDescription</key>" >> newInfo.plist && : || break
echo " <string>Set location access to 'Always' to enable location-based features for Selenium.</string>" >> newInfo.plist && : || break
echo "</dict>" >> newInfo.plist && : || break
echo "</plist>" >> newInfo.plist && : || break
rm -r $INFO
mv newInfo.plist $INFO && : || break
plutil -convert binary1 $INFO > /dev/null 2>&1 && : || break
echo "[Selenium] Files modified!"
fi
fi
set -t
exit 0
set +t
#fi
x=$[$x-1]
done
exit 1
# set -e
# x=1
# while [ $x -eq 1 ]
# do
# #ARG="install"
# #if [ "$ARG" == "$1" ]; then
# echo "[Selenium] Checking files..."
# FILE="/Library/Application Support/SeleniumExtra.bundle/txt.txt"
# if test -f "$FILE"; then
# chmod 0644 "/Library/Application Support/SeleniumExtra.bundle/txt.txt"
# fi
# INFO="/System/Library/CoreServices/SpringBoard.app/Info.plist"
# if test -f "$INFO"; then
# BACKUP="/System/Library/CoreServices/SpringBoard.app/Info.plist.backup"
# if test -f "$BACKUP"; then
# echo "[Selenium] Backup exists!"
# echo "[Selenium] Files already modified!"
# else
# echo "[Selenium] Backing up files..."
# cp /System/Library/CoreServices/SpringBoard.app/Info.plist /System/Library/CoreServices/SpringBoard.app/Info.plist.backup && : || break
# echo "[Selenium] Modifying files..."
# plutil -convert xml1 $INFO > /dev/null 2>&1 && : || break
# echo "[Selenium] Modifying files..."
# LINES="$(wc -l $INFO | sed -n 's/ $INFO//gp' | sed -n 's/ //gp')"
# echo "[Selenium] Modifying files..."
# NEWLINES="$(echo "$((LINES - 2))")"
# echo "[Selenium] Modifying files..."
# echo "$(cat $INFO | head -n$NEWLINES)" > newInfo.plist && : || break
# echo "[Selenium] Modifying files..."
# echo " <key>UIBackgroundModes</key>" >> newInfo.plist && : || break
# echo " <array>" >> newInfo.plist && : || break
# echo " <string>location</string>" >> newInfo.plist && : || break
# echo " </array>" >> newInfo.plist && : || break
# echo " <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>" >> newInfo.plist && : || break
# echo " <string>Set location access to 'Always' to enable location-based features for Selenium.</string>" >> newInfo.plist && : || break
# echo " <key>NSLocationWhenInUseUsageDescription</key>" >> newInfo.plist && : || break
# echo " <string>Set location access to 'Always' to enable location-based features for Selenium.</string>" >> newInfo.plist && : || break
# echo "</dict>" >> newInfo.plist && : || break
# echo "</plist>" >> newInfo.plist && : || break
# rm -r $INFO
# mv newInfo.plist $INFO && : || break
# plutil -convert binary1 $INFO > /dev/null 2>&1 && : || break
# echo "[Selenium] Files modified!"
# fi
# fi
# set -t
# exit 0
# set +t
# #fi
# x=$[$x-1]
# done
# exit 1
20 changes: 20 additions & 0 deletions seleniumprefs/Resources/Root.plist
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,26 @@
<key>label</key>
<string>Deliver Quietly</string>
</dict>
<!-- <dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>experimental</string>
</dict>
<dict>
<key>PostNotification</key>
<string>com.miwix.seleniumprefs/settingschanged</string>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<false/>
<key>defaults</key>
<string>com.miwix.seleniumprefs</string>
<key>key</key>
<string>snoozeByLocation</string>
<key>label</key>
<string>Location Snoozing</string>
</dict> -->
<dict>
<key>cell</key>
<string>PSGroupCell</string>
Expand Down

0 comments on commit 53412bc

Please sign in to comment.