Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Fix for WhatsApp in iOS 8 Beta
/* Taken zigmob's (http://forums.macrumors.com/showthread.php?t=1742566) workaround a step further
And added some triggers to clean up these dodgy character combinations (ff, fi, fl).
Still crashes on initial message read but saves having to manually run the sql query eve time a message contains the character combinations */
-- Working well for me so far --
/*
Kane Lai 2014-07-13
Improved by updating only the affected row in the trigger.
Also, supplied the restore script too.
*/
/* workaround fix */
update ZWAMESSAGE set ZTEXT = replace( ZTEXT, 'ff', '[f f]') where ZWAMESSAGE.ZTEXT like '%ff%';
update ZWAMESSAGE set ZTEXT = replace( ZTEXT, 'fi', '[f i]') where ZWAMESSAGE.ZTEXT like '%fi%';
update ZWAMESSAGE set ZTEXT = replace( ZTEXT, 'fl', '[f l]') where ZWAMESSAGE.ZTEXT like '%fl%';
DROP TRIGGER ios8_fix;
CREATE TRIGGER ios8_fix AFTER INSERT ON ZWAMESSAGE FOR EACH ROW
BEGIN
UPDATE ZWAMESSAGE SET ZTEXT = replace(ZTEXT, 'ff', '[f f]') WHERE ROWID = NEW.ROWID;
UPDATE ZWAMESSAGE SET ZTEXT = replace(ZTEXT, 'fi', '[f i]') WHERE ROWID = NEW.ROWID;
UPDATE ZWAMESSAGE SET ZTEXT = replace(ZTEXT, 'fl', '[f l]') WHERE ROWID = NEW.ROWID;
END;
/* fallback */
update ZWAMESSAGE set ZTEXT = replace(ZTEXT, '[f f]', 'ff') where ZWAMESSAGE.ZTEXT like '%[f f]%';
update ZWAMESSAGE set ZTEXT = replace(ZTEXT, '[f i]', 'fi') where ZWAMESSAGE.ZTEXT like '%[f i]%';
update ZWAMESSAGE set ZTEXT = replace(ZTEXT, '[f l]', 'fl') where ZWAMESSAGE.ZTEXT like '%[f l]%';
DROP TRIGGER ios8_fix;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment