├── .gitignore ├── LICENSE-GPL ├── LICENSE-MIT ├── README.md ├── android ├── .gitignore ├── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── org │ │ │ └── wordpress │ │ │ └── emailchecker │ │ │ └── EmailChecker.java │ │ └── jni │ │ ├── Android.mk │ │ ├── Application.mk │ │ ├── EmailCheckerJni.cpp │ │ ├── EmailCheckerJni.h │ │ ├── EmailDomainSpellChecker.cpp │ │ └── EmailDomainSpellChecker.h └── tools │ ├── deploy-mvn-artifact.conf-example │ └── deploy-mvn-artifact.sh ├── cli ├── Makefile └── email-checker-cli.cpp ├── common ├── EmailDomainSpellChecker.cpp └── EmailDomainSpellChecker.h └── ios ├── .gitignore ├── EmailChecker.podspec ├── EmailChecker.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── EmailChecker ├── EmailChecker-Prefix.pch ├── EmailChecker.h └── EmailChecker.mm └── EmailCheckerTests ├── EmailCheckerTests-Info.plist ├── EmailCheckerTests.mm └── en.lproj └── InfoPlist.strings /.gitignore: -------------------------------------------------------------------------------- 1 | # built application files 2 | *.apk 3 | *.ap_ 4 | *.so 5 | *.o 6 | *.a 7 | 8 | # files for the dex VM 9 | *.dex 10 | 11 | # Java class files 12 | *.class 13 | 14 | # OSX generated files 15 | .DS_Store 16 | 17 | # Intellij project files 18 | *.iml 19 | *.ipr 20 | *.iws 21 | .idea/ 22 | 23 | # build dir 24 | bin/ 25 | obj/ 26 | build/ 27 | cli/email-checker-cli 28 | -------------------------------------------------------------------------------- /LICENSE-GPL: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. 5 | 675 Mass Ave, Cambridge, MA 02139, USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Library General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | Thus, it is not the intent of this section to claim rights or contest 124 | your rights to work written entirely by you; rather, the intent is to 125 | exercise the right to control the distribution of derivative or 126 | collective works based on the Program. 127 | 128 | In addition, mere aggregation of another work not based on the Program 129 | with the Program (or with a work based on the Program) on a volume of 130 | a storage or distribution medium does not bring the other work under 131 | the scope of this License. 132 | 133 | 3. You may copy and distribute the Program (or a work based on it, 134 | under Section 2) in object code or executable form under the terms of 135 | Sections 1 and 2 above provided that you also do one of the following: 136 | 137 | a) Accompany it with the complete corresponding machine-readable 138 | source code, which must be distributed under the terms of Sections 139 | 1 and 2 above on a medium customarily used for software interchange; or, 140 | 141 | b) Accompany it with a written offer, valid for at least three 142 | years, to give any third party, for a charge no more than your 143 | cost of physically performing source distribution, a complete 144 | machine-readable copy of the corresponding source code, to be 145 | distributed under the terms of Sections 1 and 2 above on a medium 146 | customarily used for software interchange; or, 147 | 148 | c) Accompany it with the information you received as to the offer 149 | to distribute corresponding source code. (This alternative is 150 | allowed only for noncommercial distribution and only if you 151 | received the program in object code or executable form with such 152 | an offer, in accord with Subsection b above.) 153 | 154 | The source code for a work means the preferred form of the work for 155 | making modifications to it. For an executable work, complete source 156 | code means all the source code for all modules it contains, plus any 157 | associated interface definition files, plus the scripts used to 158 | control compilation and installation of the executable. However, as a 159 | special exception, the source code distributed need not include 160 | anything that is normally distributed (in either source or binary 161 | form) with the major components (compiler, kernel, and so on) of the 162 | operating system on which the executable runs, unless that component 163 | itself accompanies the executable. 164 | 165 | If distribution of executable or object code is made by offering 166 | access to copy from a designated place, then offering equivalent 167 | access to copy the source code from the same place counts as 168 | distribution of the source code, even though third parties are not 169 | compelled to copy the source along with the object code. 170 | 171 | 4. You may not copy, modify, sublicense, or distribute the Program 172 | except as expressly provided under this License. Any attempt 173 | otherwise to copy, modify, sublicense or distribute the Program is 174 | void, and will automatically terminate your rights under this License. 175 | However, parties who have received copies, or rights, from you under 176 | this License will not have their licenses terminated so long as such 177 | parties remain in full compliance. 178 | 179 | 5. You are not required to accept this License, since you have not 180 | signed it. However, nothing else grants you permission to modify or 181 | distribute the Program or its derivative works. These actions are 182 | prohibited by law if you do not accept this License. Therefore, by 183 | modifying or distributing the Program (or any work based on the 184 | Program), you indicate your acceptance of this License to do so, and 185 | all its terms and conditions for copying, distributing or modifying 186 | the Program or works based on it. 187 | 188 | 6. Each time you redistribute the Program (or any work based on the 189 | Program), the recipient automatically receives a license from the 190 | original licensor to copy, distribute or modify the Program subject to 191 | these terms and conditions. You may not impose any further 192 | restrictions on the recipients' exercise of the rights granted herein. 193 | You are not responsible for enforcing compliance by third parties to 194 | this License. 195 | 196 | 7. If, as a consequence of a court judgment or allegation of patent 197 | infringement or for any other reason (not limited to patent issues), 198 | conditions are imposed on you (whether by court order, agreement or 199 | otherwise) that contradict the conditions of this License, they do not 200 | excuse you from the conditions of this License. If you cannot 201 | distribute so as to satisfy simultaneously your obligations under this 202 | License and any other pertinent obligations, then as a consequence you 203 | may not distribute the Program at all. For example, if a patent 204 | license would not permit royalty-free redistribution of the Program by 205 | all those who receive copies directly or indirectly through you, then 206 | the only way you could satisfy both it and this License would be to 207 | refrain entirely from distribution of the Program. 208 | 209 | If any portion of this section is held invalid or unenforceable under 210 | any particular circumstance, the balance of the section is intended to 211 | apply and the section as a whole is intended to apply in other 212 | circumstances. 213 | 214 | It is not the purpose of this section to induce you to infringe any 215 | patents or other property right claims or to contest validity of any 216 | such claims; this section has the sole purpose of protecting the 217 | integrity of the free software distribution system, which is 218 | implemented by public license practices. Many people have made 219 | generous contributions to the wide range of software distributed 220 | through that system in reliance on consistent application of that 221 | system; it is up to the author/donor to decide if he or she is willing 222 | to distribute software through any other system and a licensee cannot 223 | impose that choice. 224 | 225 | This section is intended to make thoroughly clear what is believed to 226 | be a consequence of the rest of this License. 227 | 228 | 8. If the distribution and/or use of the Program is restricted in 229 | certain countries either by patents or by copyrighted interfaces, the 230 | original copyright holder who places the Program under this License 231 | may add an explicit geographical distribution limitation excluding 232 | those countries, so that distribution is permitted only in or among 233 | countries not thus excluded. In such case, this License incorporates 234 | the limitation as if written in the body of this License. 235 | 236 | 9. The Free Software Foundation may publish revised and/or new versions 237 | of the General Public License from time to time. Such new versions will 238 | be similar in spirit to the present version, but may differ in detail to 239 | address new problems or concerns. 240 | 241 | Each version is given a distinguishing version number. If the Program 242 | specifies a version number of this License which applies to it and "any 243 | later version", you have the option of following the terms and conditions 244 | either of that version or of any later version published by the Free 245 | Software Foundation. If the Program does not specify a version number of 246 | this License, you may choose any version ever published by the Free Software 247 | Foundation. 248 | 249 | 10. If you wish to incorporate parts of the Program into other free 250 | programs whose distribution conditions are different, write to the author 251 | to ask for permission. For software which is copyrighted by the Free 252 | Software Foundation, write to the Free Software Foundation; we sometimes 253 | make exceptions for this. Our decision will be guided by the two goals 254 | of preserving the free status of all derivatives of our free software and 255 | of promoting the sharing and reuse of software generally. 256 | 257 | NO WARRANTY 258 | 259 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 260 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 261 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 262 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 263 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 264 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 265 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 266 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 267 | REPAIR OR CORRECTION. 268 | 269 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 270 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 271 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 272 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 273 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 274 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 275 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 276 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 277 | POSSIBILITY OF SUCH DAMAGES. 278 | 279 | END OF TERMS AND CONDITIONS 280 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Automattic Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Email Checker for Android and iOS 2 | 3 | ## Deprecated 4 | 5 | This library is deprecated. 6 | 7 | For Android please check out [EmailChecker-Android](https://github.com/wordpress-mobile/EmailChecker-Android) 8 | 9 | For iOS please check out [EmailTypoChecker.swift](https://github.com/wordpress-mobile/WordPress-iOS/blob/25f9c8c883eff1b4d727cbd04f71448d956d9ca7/WordPress/Classes/Utility/EmailTypoChecker.swift) 10 | 11 | ## Introduction 12 | 13 | This library helps to catch simple email domain typos. Its intended to 14 | be used as a hint when a user have to enter an email address. 15 | 16 | The library is written in C++ and is inspired by the algorithm 17 | described here: http://norvig.com/spell-correct.html (Warning, it's 18 | not the exact same algo). 19 | 20 | ## How to use it in an Android project 21 | 22 | Currently gradle doesn't support NDK, so we used a trick to make it 23 | work: it generates a temporary .jar file containing .so, this file is 24 | used as a jar dependency for the final .aar file. 25 | 26 | If you want to use it in your Android project, your can add it as a 27 | library in your build.gradle file, don't forget to add the 28 | wordpress-mobile maven repository. For instance: 29 | 30 | repositories { 31 | maven { url 'http://wordpress-mobile.github.io/WordPress-Android' } 32 | } 33 | 34 | dependencies { 35 | // use the latest 0.x version 36 | compile 'org.wordpress:emailchecker:0.+' 37 | } 38 | 39 | Sample usage: 40 | 41 | String emailToCheck = "salut@gmial.com"; 42 | String suggest = (new EmailChecker()).suggestDomainCorrection(email); 43 | if (suggest.compareTo(email) != 0) { 44 | Log.v("FIXME", "did you mean: " + suggest + " ?"); 45 | } 46 | 47 | ## How to use it in an iOS project 48 | 49 | If you use [CocoaPods][1], you just have to add the following pod to 50 | your dependency list: 51 | 52 | pod 'EmailChecker', :podspec => 'https://raw.github.com/wordpress-mobile/EmailChecker/master/ios/EmailChecker.podspec' 53 | 54 | Sample usage: 55 | 56 | NSString *emailToCheck = @"salut@gmial.com"; 57 | NSString *suggestedEmail = [EmailChecker suggestDomainCorrection: @"salut@gmial.com"]; 58 | if (![suggestedEmail isEqualToString:emailToCheck]) { 59 | NSLog(@"Did you mean: %@", suggestedEmail); 60 | } 61 | 62 | ## Hack it 63 | 64 | ### Directory structure 65 | 66 | |-- common # common C++ native code 67 | |-- android 68 | | |-- jni # android specific C++ native code 69 | | `-- src # android specific Java code 70 | `-- ios 71 | |-- EmailChecker # iOS specific Obj-C++ code 72 | `-- EmailCheckerTests # Obj-C++ tests (testing C++ code in common/) 73 | 74 | ### The steps to add a new public method 75 | 76 | 1. Create the public method in common/ 77 | 1. Wrap it as a Java jni method in android/jni and android/java 78 | 1. Wrap it as a Obj-C++ method in ios/EmailChecker/ 79 | 80 | ### Build 81 | 82 | * For Android 83 | 84 | ``` 85 | $ cd android && gradle build 86 | ``` 87 | 88 | * For iOS 89 | 90 | ``` 91 | $ cd ios && xcodebuild 92 | ``` 93 | 94 | ## LICENSE 95 | 96 | This library is dual licensed unded MIT and GPL v2. 97 | 98 | [1]: http://cocoapods.org 99 | [2]: https://github.com/wordpress-mobile/WordPress-Android 100 | [3]: https://github.com/wordpress-mobile/WordPress-iOS 101 | 102 | ## CHANGELOG 103 | 104 | ### 0.2 105 | 106 | * Failback to the identity function when native libraries can't be loaded 107 | (weird Android ROMs). 108 | * Update to gradle-android 0.8 and use gradle to build jni code 109 | 110 | ### 0.1 111 | 112 | * Initial release 113 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /libs/ 3 | .gradle/ 4 | local.properties 5 | tools/deploy-mvn-artifact.conf 6 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenCentral() 4 | } 5 | dependencies { 6 | classpath 'com.android.tools.build:gradle:0.12.+' 7 | } 8 | } 9 | 10 | apply plugin: 'android-library' 11 | 12 | group 'org.wordpress' 13 | version '0.3' 14 | 15 | repositories { 16 | mavenCentral() 17 | } 18 | 19 | android { 20 | compileSdkVersion 19 21 | buildToolsVersion "19.1.0" 22 | publishNonDefault true 23 | 24 | defaultConfig { 25 | minSdkVersion 7 26 | targetSdkVersion 19 27 | ndk { 28 | moduleName "emailchecker" 29 | cFlags "-std=gnu++11" 30 | stl "gnustl_shared" 31 | abiFilter "armeabi x86 mips" 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wordpress-mobile/EmailChecker/615c14e39d4cba595e62cc2cfdb650e01666b927/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jan 31 18:30:45 CET 2014 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip 7 | -------------------------------------------------------------------------------- /android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'email-checker' -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/src/main/java/org/wordpress/emailchecker/EmailChecker.java: -------------------------------------------------------------------------------- 1 | package org.wordpress.emailchecker; 2 | 3 | import android.util.Log; 4 | 5 | public class EmailChecker { 6 | static boolean sInitialized; 7 | 8 | static { 9 | try { 10 | System.loadLibrary("gnustl_shared"); 11 | System.loadLibrary("emailchecker"); 12 | sInitialized = true; 13 | } catch (UnsatisfiedLinkError e) { 14 | Log.e("EmailChecker", "Unable to load native libraries, EmailChecker disabled"); 15 | } 16 | } 17 | 18 | public String suggestDomainCorrection(String email) { 19 | if (sInitialized) { 20 | return suggestDomainCorrectionNative(email); 21 | } 22 | return email; 23 | } 24 | 25 | public native String suggestDomainCorrectionNative(String email); 26 | } 27 | -------------------------------------------------------------------------------- /android/src/main/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_MODULE := emailchecker 5 | LOCAL_CFLAGS := -std=gnu++11 -fno-exceptions -fno-rtti 6 | 7 | EMAILCHECKER_SOURCES = $(shell find $(LOCAL_PATH)/../../../../common/ -name "*.cpp"|sed 's+$(LOCAL_PATH)/++') 8 | 9 | ANDROID_SOURCES = $(shell find $(LOCAL_PATH)/../jni -name "*.cpp"|sed 's+$(LOCAL_PATH)/++') 10 | 11 | LOCAL_SRC_FILES := $(EMAILCHECKER_SOURCES) $(ANDROID_SOURCES) 12 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/ $(LOCAL_PATH)/../../../../common/ 13 | 14 | APP_STL := gnustl_shared 15 | APP_ABI := armeabi x86 16 | 17 | include $(BUILD_SHARED_LIBRARY) 18 | -------------------------------------------------------------------------------- /android/src/main/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_STL := gnustl_shared 2 | APP_ABI := armeabi x86 3 | -------------------------------------------------------------------------------- /android/src/main/jni/EmailCheckerJni.cpp: -------------------------------------------------------------------------------- 1 | #include "EmailCheckerJni.h" 2 | #include "EmailDomainSpellChecker.h" 3 | 4 | JNIEXPORT jstring JNICALL Java_org_wordpress_emailchecker_EmailChecker_suggestDomainCorrectionNative 5 | (JNIEnv *env, jobject obj, jstring jStringEmail) { 6 | const char *nativeString = env->GetStringUTFChars(jStringEmail, 0); 7 | std::string email = std::string(nativeString); 8 | EmailDomainSpellChecker edsc; 9 | std::string resString = edsc.suggestDomainCorrection(email); 10 | env->ReleaseStringUTFChars(jStringEmail, nativeString); 11 | return env->NewStringUTF(resString.data()); 12 | } 13 | -------------------------------------------------------------------------------- /android/src/main/jni/EmailCheckerJni.h: -------------------------------------------------------------------------------- 1 | #ifndef _Included_org_wordpress_emailchecker_EmailChecker 2 | #define _Included_org_wordpress_emailchecker_EmailChecker 3 | 4 | #include 5 | #include 6 | #include "EmailDomainSpellChecker.h" 7 | 8 | extern "C" { 9 | 10 | JNIEXPORT jstring JNICALL Java_org_wordpress_emailchecker_EmailChecker_suggestDomainCorrectionNative 11 | (JNIEnv *, jobject, jstring); 12 | 13 | } 14 | #endif 15 | -------------------------------------------------------------------------------- /android/src/main/jni/EmailDomainSpellChecker.cpp: -------------------------------------------------------------------------------- 1 | ../../../../common/EmailDomainSpellChecker.cpp -------------------------------------------------------------------------------- /android/src/main/jni/EmailDomainSpellChecker.h: -------------------------------------------------------------------------------- 1 | ../../../../common/EmailDomainSpellChecker.h -------------------------------------------------------------------------------- /android/tools/deploy-mvn-artifact.conf-example: -------------------------------------------------------------------------------- 1 | LOCAL_GH_PAGES=file:///Users/max/work/automattic/WordPress-Android-gh-pages/ 2 | -------------------------------------------------------------------------------- /android/tools/deploy-mvn-artifact.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh +v 2 | 3 | . tools/deploy-mvn-artifact.conf 4 | PROJECT=. 5 | VERSION=`grep -E 'version' $PROJECT/build.gradle \ 6 | | sed s/version// \ 7 | | grep -Eo "[a-zA-Z0-9.-]+"` 8 | GROUPID=org.wordpress 9 | ARTIFACTID=emailchecker 10 | AARFILE=build/outputs/aar/email-checker-$VERSION-release.aar 11 | 12 | # Deploy release build 13 | mvn deploy:deploy-file -Dfile=$AARFILE \ 14 | -Durl=$LOCAL_GH_PAGES -DgroupId=$GROUPID \ 15 | -DartifactId=$ARTIFACTID -Dversion=$VERSION 16 | 17 | echo ======================================== 18 | echo 19 | echo \"$GROUPID:$ARTIFACTID:$VERSION\" deployed -------------------------------------------------------------------------------- /cli/Makefile: -------------------------------------------------------------------------------- 1 | SOURCES=$(shell find ../common/ -name "*.cpp") email-checker-cli.cpp 2 | OBJS=$(SOURCES:.cpp=.o) 3 | BIN=email-checker-cli 4 | CFLAGS+=-std=c++11 -I../common 5 | 6 | $(BIN): $(OBJS) 7 | clang $(CLFAGS) $(OBJS) -lc++ -o $(BIN) 8 | 9 | %.o: %.cpp 10 | clang $(CFLAGS) -c -o $@ $< 11 | 12 | clean: 13 | rm -f $(BIN) $(OBJS) 14 | -------------------------------------------------------------------------------- /cli/email-checker-cli.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "EmailDomainSpellChecker.h" 3 | 4 | int main(int argc, char** argv) { 5 | EmailDomainSpellChecker edsc; 6 | for (int i = 1; i < argc; i++) { 7 | 8 | std::cout << argv[i] << " -> " << edsc.suggestDomainCorrection(argv[i]) 9 | << std::endl; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /common/EmailDomainSpellChecker.cpp: -------------------------------------------------------------------------------- 1 | #include "EmailDomainSpellChecker.h" 2 | 3 | const static std::unordered_set sModel = { 4 | "yahoo.com", "google.com", "hotmail.com", "gmail.com", "me.com", "aol.com", "mac.com", 5 | "live.com", "comcast.net", "comcast.com", "googlemail.com", "msn.com", "hotmail.co.uk", "yahoo.co.uk", 6 | "facebook.com", "verizon.net", "sbcglobal.net", "att.net", "gmx.com", "mail.com", "outlook.com", 7 | "ymail.com", 8 | }; 9 | 10 | #pragma mark - Constructors and destructore 11 | 12 | EmailDomainSpellChecker::EmailDomainSpellChecker() { 13 | } 14 | 15 | #pragma mark - Private methods 16 | 17 | std::string EmailDomainSpellChecker::suggest(const std::string &word) { 18 | std::unordered_set candidates; 19 | std::unordered_set results; 20 | 21 | // word is not mispelled 22 | if (sModel.find(word) != sModel.end()) { 23 | return word; 24 | } 25 | 26 | // add edited and known words the results 27 | edits(word, results); 28 | known(results, candidates); 29 | 30 | if (candidates.size() > 0) { 31 | return *candidates.begin(); 32 | } 33 | 34 | return ""; 35 | } 36 | 37 | void EmailDomainSpellChecker::known(const std::unordered_set &words, 38 | std::unordered_set &results) { 39 | for (std::unordered_set::const_iterator i = words.begin(); i != words.end(); i++) { 40 | if (sModel.find(*i) != sModel.end()) { 41 | results.insert(*i); 42 | } 43 | } 44 | } 45 | 46 | void EmailDomainSpellChecker::edits(const std::string &word, std::unordered_set &results) { 47 | // deletes 48 | for (size_t i = 0; i < word.size(); i++) { 49 | results.insert(word.substr(0, i) + word.substr(i + 1)); 50 | } 51 | // transposes 52 | for (size_t i = 0; i < word.size() - 1; i++) { 53 | results.insert(word.substr(0, i) + word[i + 1] + word[i] + word.substr(i + 2)); 54 | } 55 | // replaces 56 | for (size_t i = 0; i < word.size(); i++) { 57 | for (char j = 'a'; j <= 'z'; ++j) { 58 | results.insert(word.substr(0, i) + j + word.substr(i + 1)); 59 | } 60 | } 61 | // inserts 62 | for (size_t i = 0; i < word.size() + 1; i++) { 63 | for (char j = 'a'; j <= 'z'; ++j) { 64 | results.insert(word.substr(0, i) + j + word.substr(i)); 65 | } 66 | } 67 | } 68 | 69 | #pragma mark - Public methods 70 | 71 | std::string EmailDomainSpellChecker::suggestDomainCorrection(const std::string &emailAddress) { 72 | size_t atCharPosition = emailAddress.find('@'); 73 | std::string extractedDomain = std::string(emailAddress.data() + atCharPosition + 1); 74 | // don't check domain name shorter than 1 char 75 | if (extractedDomain.size() <= 1) { 76 | return emailAddress; 77 | } 78 | std::string suggestion = suggest(extractedDomain); 79 | // If domain suggestion is the same as original, return original email address or not found 80 | if (suggestion.compare(extractedDomain) == 0 || suggestion.size() == 0) { 81 | return emailAddress; 82 | } 83 | // construct return string 84 | return emailAddress.substr(0, atCharPosition + 1) + suggestion; 85 | } 86 | -------------------------------------------------------------------------------- /common/EmailDomainSpellChecker.h: -------------------------------------------------------------------------------- 1 | #ifndef _DOMAINEMAILSPELLCHECKER_H_ 2 | #define _DOMAINEMAILSPELLCHECKER_H_ 3 | 4 | #include 5 | #include 6 | 7 | class EmailDomainSpellChecker { 8 | private: 9 | std::unordered_set mModel; 10 | 11 | private: 12 | void known(const std::unordered_set &words, std::unordered_set &results); 13 | void edits(const std::string &word, std::unordered_set &results); 14 | std::string suggest(const std::string &word); 15 | std::string extractDomain(const std::string &word); 16 | 17 | public: 18 | EmailDomainSpellChecker(); 19 | std::string suggestDomainCorrection(const std::string &word); 20 | }; 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.pbxuser 2 | *.mode1v3 3 | *.mode2v3 4 | *.perspectivev3 5 | 6 | !default.pbxuser 7 | !default.mode1v3 8 | !default.mode2v3 9 | !default.perspectivev3 10 | 11 | xcuserdata 12 | -------------------------------------------------------------------------------- /ios/EmailChecker.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | 3 | s.name = "EmailChecker" 4 | s.version = "0.1" 5 | s.summary = "EmailChecker helps to catch simple email domain typos." 6 | 7 | s.description = <<-DESC 8 | EmailChecker helps to catch simple email domain 9 | typos. Its intended to be used as a hint when a 10 | user have to enter an email address. 11 | 12 | give it an email string and it returns a suggestion 13 | if one found or the original string if not. 14 | DESC 15 | 16 | s.homepage = "https://github.com/wordpress-mobile/EmailChecker" 17 | s.license = 'MIT' 18 | s.author = { "WordPress-Mobile" => "mobile@automattic.com" } 19 | s.platform = :ios, "5.0" 20 | s.library = 'c++' 21 | s.source = { :git => "https://github.com/wordpress-mobile/EmailChecker.git", :tag => "0.1" } 22 | s.source_files = 'ios/EmailChecker/**/*.{h,mm}', 'common/**/*.{h,cpp}' 23 | s.private_header_files = 'common/**/*.h' 24 | 25 | end 26 | -------------------------------------------------------------------------------- /ios/EmailChecker.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 507765701833AB6000BA6CA5 /* EmailChecker.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5077656F1833AB6000BA6CA5 /* EmailChecker.mm */; }; 11 | 5086AFC118324A3F00ED61AF /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5086AFC018324A3F00ED61AF /* Foundation.framework */; }; 12 | 5086AFC618324A3F00ED61AF /* EmailChecker.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5086AFC518324A3F00ED61AF /* EmailChecker.h */; }; 13 | 5086AFCF18324A3F00ED61AF /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5086AFCE18324A3F00ED61AF /* XCTest.framework */; }; 14 | 5086AFD018324A3F00ED61AF /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5086AFC018324A3F00ED61AF /* Foundation.framework */; }; 15 | 5086AFD218324A3F00ED61AF /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5086AFD118324A3F00ED61AF /* UIKit.framework */; }; 16 | 5086AFD518324A3F00ED61AF /* libEmailChecker.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5086AFBD18324A3F00ED61AF /* libEmailChecker.a */; }; 17 | 5086AFDB18324A3F00ED61AF /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 5086AFD918324A3F00ED61AF /* InfoPlist.strings */; }; 18 | 5086AFDD18324A3F00ED61AF /* EmailCheckerTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5086AFDC18324A3F00ED61AF /* EmailCheckerTests.mm */; }; 19 | 50F8B77D18327EF100ABE203 /* EmailDomainSpellChecker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50F8B77B18327EF100ABE203 /* EmailDomainSpellChecker.cpp */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | 5086AFD318324A3F00ED61AF /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = 5086AFB518324A3F00ED61AF /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = 5086AFBC18324A3F00ED61AF; 28 | remoteInfo = EmailChecker; 29 | }; 30 | /* End PBXContainerItemProxy section */ 31 | 32 | /* Begin PBXCopyFilesBuildPhase section */ 33 | 5086AFBB18324A3F00ED61AF /* CopyFiles */ = { 34 | isa = PBXCopyFilesBuildPhase; 35 | buildActionMask = 2147483647; 36 | dstPath = "include/$(PRODUCT_NAME)"; 37 | dstSubfolderSpec = 16; 38 | files = ( 39 | 5086AFC618324A3F00ED61AF /* EmailChecker.h in CopyFiles */, 40 | ); 41 | runOnlyForDeploymentPostprocessing = 0; 42 | }; 43 | /* End PBXCopyFilesBuildPhase section */ 44 | 45 | /* Begin PBXFileReference section */ 46 | 5077656F1833AB6000BA6CA5 /* EmailChecker.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = EmailChecker.mm; sourceTree = ""; }; 47 | 5086AFBD18324A3F00ED61AF /* libEmailChecker.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libEmailChecker.a; sourceTree = BUILT_PRODUCTS_DIR; }; 48 | 5086AFC018324A3F00ED61AF /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 49 | 5086AFC418324A3F00ED61AF /* EmailChecker-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "EmailChecker-Prefix.pch"; sourceTree = ""; }; 50 | 5086AFC518324A3F00ED61AF /* EmailChecker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EmailChecker.h; sourceTree = ""; }; 51 | 5086AFCD18324A3F00ED61AF /* EmailCheckerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = EmailCheckerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | 5086AFCE18324A3F00ED61AF /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 53 | 5086AFD118324A3F00ED61AF /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; 54 | 5086AFD818324A3F00ED61AF /* EmailCheckerTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "EmailCheckerTests-Info.plist"; sourceTree = ""; }; 55 | 5086AFDA18324A3F00ED61AF /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 56 | 5086AFDC18324A3F00ED61AF /* EmailCheckerTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = EmailCheckerTests.mm; sourceTree = ""; }; 57 | 50F8B77B18327EF100ABE203 /* EmailDomainSpellChecker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EmailDomainSpellChecker.cpp; sourceTree = ""; }; 58 | 50F8B77C18327EF100ABE203 /* EmailDomainSpellChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EmailDomainSpellChecker.h; sourceTree = ""; }; 59 | /* End PBXFileReference section */ 60 | 61 | /* Begin PBXFrameworksBuildPhase section */ 62 | 5086AFBA18324A3F00ED61AF /* Frameworks */ = { 63 | isa = PBXFrameworksBuildPhase; 64 | buildActionMask = 2147483647; 65 | files = ( 66 | 5086AFC118324A3F00ED61AF /* Foundation.framework in Frameworks */, 67 | ); 68 | runOnlyForDeploymentPostprocessing = 0; 69 | }; 70 | 5086AFCA18324A3F00ED61AF /* Frameworks */ = { 71 | isa = PBXFrameworksBuildPhase; 72 | buildActionMask = 2147483647; 73 | files = ( 74 | 5086AFD518324A3F00ED61AF /* libEmailChecker.a in Frameworks */, 75 | 5086AFCF18324A3F00ED61AF /* XCTest.framework in Frameworks */, 76 | 5086AFD218324A3F00ED61AF /* UIKit.framework in Frameworks */, 77 | 5086AFD018324A3F00ED61AF /* Foundation.framework in Frameworks */, 78 | ); 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | /* End PBXFrameworksBuildPhase section */ 82 | 83 | /* Begin PBXGroup section */ 84 | 5086AFB418324A3F00ED61AF = { 85 | isa = PBXGroup; 86 | children = ( 87 | 50F8B77A18327EF100ABE203 /* common */, 88 | 5086AFC218324A3F00ED61AF /* EmailChecker */, 89 | 5086AFD618324A3F00ED61AF /* EmailCheckerTests */, 90 | 5086AFBF18324A3F00ED61AF /* Frameworks */, 91 | 5086AFBE18324A3F00ED61AF /* Products */, 92 | ); 93 | sourceTree = ""; 94 | }; 95 | 5086AFBE18324A3F00ED61AF /* Products */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | 5086AFBD18324A3F00ED61AF /* libEmailChecker.a */, 99 | 5086AFCD18324A3F00ED61AF /* EmailCheckerTests.xctest */, 100 | ); 101 | name = Products; 102 | sourceTree = ""; 103 | }; 104 | 5086AFBF18324A3F00ED61AF /* Frameworks */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 5086AFC018324A3F00ED61AF /* Foundation.framework */, 108 | 5086AFCE18324A3F00ED61AF /* XCTest.framework */, 109 | 5086AFD118324A3F00ED61AF /* UIKit.framework */, 110 | ); 111 | name = Frameworks; 112 | sourceTree = ""; 113 | }; 114 | 5086AFC218324A3F00ED61AF /* EmailChecker */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | 5077656F1833AB6000BA6CA5 /* EmailChecker.mm */, 118 | 5086AFC518324A3F00ED61AF /* EmailChecker.h */, 119 | 5086AFC318324A3F00ED61AF /* Supporting Files */, 120 | ); 121 | path = EmailChecker; 122 | sourceTree = ""; 123 | }; 124 | 5086AFC318324A3F00ED61AF /* Supporting Files */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | 5086AFC418324A3F00ED61AF /* EmailChecker-Prefix.pch */, 128 | ); 129 | name = "Supporting Files"; 130 | sourceTree = ""; 131 | }; 132 | 5086AFD618324A3F00ED61AF /* EmailCheckerTests */ = { 133 | isa = PBXGroup; 134 | children = ( 135 | 5086AFDC18324A3F00ED61AF /* EmailCheckerTests.mm */, 136 | 5086AFD718324A3F00ED61AF /* Supporting Files */, 137 | ); 138 | path = EmailCheckerTests; 139 | sourceTree = ""; 140 | }; 141 | 5086AFD718324A3F00ED61AF /* Supporting Files */ = { 142 | isa = PBXGroup; 143 | children = ( 144 | 5086AFD818324A3F00ED61AF /* EmailCheckerTests-Info.plist */, 145 | 5086AFD918324A3F00ED61AF /* InfoPlist.strings */, 146 | ); 147 | name = "Supporting Files"; 148 | sourceTree = ""; 149 | }; 150 | 50F8B77A18327EF100ABE203 /* common */ = { 151 | isa = PBXGroup; 152 | children = ( 153 | 50F8B77B18327EF100ABE203 /* EmailDomainSpellChecker.cpp */, 154 | 50F8B77C18327EF100ABE203 /* EmailDomainSpellChecker.h */, 155 | ); 156 | name = common; 157 | path = ../common; 158 | sourceTree = ""; 159 | }; 160 | /* End PBXGroup section */ 161 | 162 | /* Begin PBXNativeTarget section */ 163 | 5086AFBC18324A3F00ED61AF /* EmailChecker */ = { 164 | isa = PBXNativeTarget; 165 | buildConfigurationList = 5086AFE018324A3F00ED61AF /* Build configuration list for PBXNativeTarget "EmailChecker" */; 166 | buildPhases = ( 167 | 5086AFB918324A3F00ED61AF /* Sources */, 168 | 5086AFBA18324A3F00ED61AF /* Frameworks */, 169 | 5086AFBB18324A3F00ED61AF /* CopyFiles */, 170 | ); 171 | buildRules = ( 172 | ); 173 | dependencies = ( 174 | ); 175 | name = EmailChecker; 176 | productName = EmailChecker; 177 | productReference = 5086AFBD18324A3F00ED61AF /* libEmailChecker.a */; 178 | productType = "com.apple.product-type.library.static"; 179 | }; 180 | 5086AFCC18324A3F00ED61AF /* EmailCheckerTests */ = { 181 | isa = PBXNativeTarget; 182 | buildConfigurationList = 5086AFE318324A3F00ED61AF /* Build configuration list for PBXNativeTarget "EmailCheckerTests" */; 183 | buildPhases = ( 184 | 5086AFC918324A3F00ED61AF /* Sources */, 185 | 5086AFCA18324A3F00ED61AF /* Frameworks */, 186 | 5086AFCB18324A3F00ED61AF /* Resources */, 187 | ); 188 | buildRules = ( 189 | ); 190 | dependencies = ( 191 | 5086AFD418324A3F00ED61AF /* PBXTargetDependency */, 192 | ); 193 | name = EmailCheckerTests; 194 | productName = EmailCheckerTests; 195 | productReference = 5086AFCD18324A3F00ED61AF /* EmailCheckerTests.xctest */; 196 | productType = "com.apple.product-type.bundle.unit-test"; 197 | }; 198 | /* End PBXNativeTarget section */ 199 | 200 | /* Begin PBXProject section */ 201 | 5086AFB518324A3F00ED61AF /* Project object */ = { 202 | isa = PBXProject; 203 | attributes = { 204 | LastUpgradeCheck = 0500; 205 | ORGANIZATIONNAME = Automattic; 206 | }; 207 | buildConfigurationList = 5086AFB818324A3F00ED61AF /* Build configuration list for PBXProject "EmailChecker" */; 208 | compatibilityVersion = "Xcode 3.2"; 209 | developmentRegion = English; 210 | hasScannedForEncodings = 0; 211 | knownRegions = ( 212 | en, 213 | ); 214 | mainGroup = 5086AFB418324A3F00ED61AF; 215 | productRefGroup = 5086AFBE18324A3F00ED61AF /* Products */; 216 | projectDirPath = ""; 217 | projectRoot = ""; 218 | targets = ( 219 | 5086AFBC18324A3F00ED61AF /* EmailChecker */, 220 | 5086AFCC18324A3F00ED61AF /* EmailCheckerTests */, 221 | ); 222 | }; 223 | /* End PBXProject section */ 224 | 225 | /* Begin PBXResourcesBuildPhase section */ 226 | 5086AFCB18324A3F00ED61AF /* Resources */ = { 227 | isa = PBXResourcesBuildPhase; 228 | buildActionMask = 2147483647; 229 | files = ( 230 | 5086AFDB18324A3F00ED61AF /* InfoPlist.strings in Resources */, 231 | ); 232 | runOnlyForDeploymentPostprocessing = 0; 233 | }; 234 | /* End PBXResourcesBuildPhase section */ 235 | 236 | /* Begin PBXSourcesBuildPhase section */ 237 | 5086AFB918324A3F00ED61AF /* Sources */ = { 238 | isa = PBXSourcesBuildPhase; 239 | buildActionMask = 2147483647; 240 | files = ( 241 | 507765701833AB6000BA6CA5 /* EmailChecker.mm in Sources */, 242 | 50F8B77D18327EF100ABE203 /* EmailDomainSpellChecker.cpp in Sources */, 243 | ); 244 | runOnlyForDeploymentPostprocessing = 0; 245 | }; 246 | 5086AFC918324A3F00ED61AF /* Sources */ = { 247 | isa = PBXSourcesBuildPhase; 248 | buildActionMask = 2147483647; 249 | files = ( 250 | 5086AFDD18324A3F00ED61AF /* EmailCheckerTests.mm in Sources */, 251 | ); 252 | runOnlyForDeploymentPostprocessing = 0; 253 | }; 254 | /* End PBXSourcesBuildPhase section */ 255 | 256 | /* Begin PBXTargetDependency section */ 257 | 5086AFD418324A3F00ED61AF /* PBXTargetDependency */ = { 258 | isa = PBXTargetDependency; 259 | target = 5086AFBC18324A3F00ED61AF /* EmailChecker */; 260 | targetProxy = 5086AFD318324A3F00ED61AF /* PBXContainerItemProxy */; 261 | }; 262 | /* End PBXTargetDependency section */ 263 | 264 | /* Begin PBXVariantGroup section */ 265 | 5086AFD918324A3F00ED61AF /* InfoPlist.strings */ = { 266 | isa = PBXVariantGroup; 267 | children = ( 268 | 5086AFDA18324A3F00ED61AF /* en */, 269 | ); 270 | name = InfoPlist.strings; 271 | sourceTree = ""; 272 | }; 273 | /* End PBXVariantGroup section */ 274 | 275 | /* Begin XCBuildConfiguration section */ 276 | 5086AFDE18324A3F00ED61AF /* Debug */ = { 277 | isa = XCBuildConfiguration; 278 | buildSettings = { 279 | ALWAYS_SEARCH_USER_PATHS = NO; 280 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 281 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 282 | CLANG_CXX_LIBRARY = "libc++"; 283 | CLANG_ENABLE_MODULES = YES; 284 | CLANG_ENABLE_OBJC_ARC = YES; 285 | CLANG_WARN_BOOL_CONVERSION = YES; 286 | CLANG_WARN_CONSTANT_CONVERSION = YES; 287 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 288 | CLANG_WARN_EMPTY_BODY = YES; 289 | CLANG_WARN_ENUM_CONVERSION = YES; 290 | CLANG_WARN_INT_CONVERSION = YES; 291 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 292 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 293 | COPY_PHASE_STRIP = NO; 294 | GCC_C_LANGUAGE_STANDARD = gnu99; 295 | GCC_DYNAMIC_NO_PIC = NO; 296 | GCC_OPTIMIZATION_LEVEL = 0; 297 | GCC_PREPROCESSOR_DEFINITIONS = ( 298 | "DEBUG=1", 299 | "$(inherited)", 300 | ); 301 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 302 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 303 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 304 | GCC_WARN_UNDECLARED_SELECTOR = YES; 305 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 306 | GCC_WARN_UNUSED_FUNCTION = YES; 307 | GCC_WARN_UNUSED_VARIABLE = YES; 308 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 309 | ONLY_ACTIVE_ARCH = YES; 310 | SDKROOT = iphoneos; 311 | }; 312 | name = Debug; 313 | }; 314 | 5086AFDF18324A3F00ED61AF /* Release */ = { 315 | isa = XCBuildConfiguration; 316 | buildSettings = { 317 | ALWAYS_SEARCH_USER_PATHS = NO; 318 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 319 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 320 | CLANG_CXX_LIBRARY = "libc++"; 321 | CLANG_ENABLE_MODULES = YES; 322 | CLANG_ENABLE_OBJC_ARC = YES; 323 | CLANG_WARN_BOOL_CONVERSION = YES; 324 | CLANG_WARN_CONSTANT_CONVERSION = YES; 325 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 326 | CLANG_WARN_EMPTY_BODY = YES; 327 | CLANG_WARN_ENUM_CONVERSION = YES; 328 | CLANG_WARN_INT_CONVERSION = YES; 329 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 330 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 331 | COPY_PHASE_STRIP = YES; 332 | ENABLE_NS_ASSERTIONS = NO; 333 | GCC_C_LANGUAGE_STANDARD = gnu99; 334 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 335 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 336 | GCC_WARN_UNDECLARED_SELECTOR = YES; 337 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 338 | GCC_WARN_UNUSED_FUNCTION = YES; 339 | GCC_WARN_UNUSED_VARIABLE = YES; 340 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 341 | SDKROOT = iphoneos; 342 | VALIDATE_PRODUCT = YES; 343 | }; 344 | name = Release; 345 | }; 346 | 5086AFE118324A3F00ED61AF /* Debug */ = { 347 | isa = XCBuildConfiguration; 348 | buildSettings = { 349 | DSTROOT = /tmp/EmailChecker.dst; 350 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 351 | GCC_PREFIX_HEADER = "EmailChecker/EmailChecker-Prefix.pch"; 352 | OTHER_LDFLAGS = "-ObjC"; 353 | PRODUCT_NAME = "$(TARGET_NAME)"; 354 | SKIP_INSTALL = YES; 355 | }; 356 | name = Debug; 357 | }; 358 | 5086AFE218324A3F00ED61AF /* Release */ = { 359 | isa = XCBuildConfiguration; 360 | buildSettings = { 361 | DSTROOT = /tmp/EmailChecker.dst; 362 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 363 | GCC_PREFIX_HEADER = "EmailChecker/EmailChecker-Prefix.pch"; 364 | OTHER_LDFLAGS = "-ObjC"; 365 | PRODUCT_NAME = "$(TARGET_NAME)"; 366 | SKIP_INSTALL = YES; 367 | }; 368 | name = Release; 369 | }; 370 | 5086AFE418324A3F00ED61AF /* Debug */ = { 371 | isa = XCBuildConfiguration; 372 | buildSettings = { 373 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 374 | FRAMEWORK_SEARCH_PATHS = ( 375 | "$(SDKROOT)/Developer/Library/Frameworks", 376 | "$(inherited)", 377 | "$(DEVELOPER_FRAMEWORKS_DIR)", 378 | ); 379 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 380 | GCC_PREFIX_HEADER = "EmailChecker/EmailChecker-Prefix.pch"; 381 | GCC_PREPROCESSOR_DEFINITIONS = ( 382 | "DEBUG=1", 383 | "$(inherited)", 384 | ); 385 | INFOPLIST_FILE = "EmailCheckerTests/EmailCheckerTests-Info.plist"; 386 | PRODUCT_NAME = "$(TARGET_NAME)"; 387 | WRAPPER_EXTENSION = xctest; 388 | }; 389 | name = Debug; 390 | }; 391 | 5086AFE518324A3F00ED61AF /* Release */ = { 392 | isa = XCBuildConfiguration; 393 | buildSettings = { 394 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 395 | FRAMEWORK_SEARCH_PATHS = ( 396 | "$(SDKROOT)/Developer/Library/Frameworks", 397 | "$(inherited)", 398 | "$(DEVELOPER_FRAMEWORKS_DIR)", 399 | ); 400 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 401 | GCC_PREFIX_HEADER = "EmailChecker/EmailChecker-Prefix.pch"; 402 | INFOPLIST_FILE = "EmailCheckerTests/EmailCheckerTests-Info.plist"; 403 | PRODUCT_NAME = "$(TARGET_NAME)"; 404 | WRAPPER_EXTENSION = xctest; 405 | }; 406 | name = Release; 407 | }; 408 | /* End XCBuildConfiguration section */ 409 | 410 | /* Begin XCConfigurationList section */ 411 | 5086AFB818324A3F00ED61AF /* Build configuration list for PBXProject "EmailChecker" */ = { 412 | isa = XCConfigurationList; 413 | buildConfigurations = ( 414 | 5086AFDE18324A3F00ED61AF /* Debug */, 415 | 5086AFDF18324A3F00ED61AF /* Release */, 416 | ); 417 | defaultConfigurationIsVisible = 0; 418 | defaultConfigurationName = Release; 419 | }; 420 | 5086AFE018324A3F00ED61AF /* Build configuration list for PBXNativeTarget "EmailChecker" */ = { 421 | isa = XCConfigurationList; 422 | buildConfigurations = ( 423 | 5086AFE118324A3F00ED61AF /* Debug */, 424 | 5086AFE218324A3F00ED61AF /* Release */, 425 | ); 426 | defaultConfigurationIsVisible = 0; 427 | defaultConfigurationName = Release; 428 | }; 429 | 5086AFE318324A3F00ED61AF /* Build configuration list for PBXNativeTarget "EmailCheckerTests" */ = { 430 | isa = XCConfigurationList; 431 | buildConfigurations = ( 432 | 5086AFE418324A3F00ED61AF /* Debug */, 433 | 5086AFE518324A3F00ED61AF /* Release */, 434 | ); 435 | defaultConfigurationIsVisible = 0; 436 | defaultConfigurationName = Release; 437 | }; 438 | /* End XCConfigurationList section */ 439 | }; 440 | rootObject = 5086AFB518324A3F00ED61AF /* Project object */; 441 | } 442 | -------------------------------------------------------------------------------- /ios/EmailChecker.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/EmailChecker/EmailChecker-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #endif 10 | -------------------------------------------------------------------------------- /ios/EmailChecker/EmailChecker.h: -------------------------------------------------------------------------------- 1 | // 2 | // EmailChecker.h 3 | // EmailChecker 4 | // 5 | // Created by Maxime Biais on 12/11/2013. 6 | // Copyright (c) 2013 Automattic. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface EmailChecker : NSObject 12 | 13 | + (NSString *) suggestDomainCorrection:(NSString *)email; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /ios/EmailChecker/EmailChecker.mm: -------------------------------------------------------------------------------- 1 | // 2 | // EmailChecker.m 3 | // EmailChecker 4 | // 5 | // Created by Maxime Biais on 12/11/2013. 6 | // Copyright (c) 2013 Automattic. All rights reserved. 7 | // 8 | 9 | #import "EmailChecker.h" 10 | #import "EmailDomainSpellChecker.h" 11 | #import 12 | 13 | @implementation EmailChecker 14 | 15 | + (NSString *) suggestDomainCorrection:(NSString *)email { 16 | EmailDomainSpellChecker edsc; 17 | std::string stdEmail([email UTF8String]); 18 | std::string suggested = edsc.suggestDomainCorrection(stdEmail); 19 | return [NSString stringWithCString:suggested.c_str() 20 | encoding:[NSString defaultCStringEncoding]]; 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /ios/EmailCheckerTests/EmailCheckerTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.wordpress.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /ios/EmailCheckerTests/EmailCheckerTests.mm: -------------------------------------------------------------------------------- 1 | // 2 | // EmailCheckerTests.m 3 | // EmailCheckerTests 4 | // 5 | // Created by Maxime Biais on 12/11/2013. 6 | // Copyright (c) 2013 Automattic. All rights reserved. 7 | // 8 | 9 | #import 10 | #include "EmailDomainSpellChecker.h" 11 | 12 | @interface EmailCheckerTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation EmailCheckerTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | EmailDomainSpellChecker *edsc = new EmailDomainSpellChecker(); 30 | std::string toTest; 31 | 32 | // Not modified tests 33 | toTest = "hello@mop.com"; 34 | XCTAssert(edsc->suggestDomainCorrection(toTest).compare(toTest) == 0, @"%s must not be corrected", toTest.c_str()); 35 | 36 | toTest = "hello@gmail.com"; 37 | XCTAssert(edsc->suggestDomainCorrection(toTest).compare(toTest) == 0, @"%s must not be corrected", toTest.c_str()); 38 | 39 | toTest = "hello"; 40 | XCTAssert(edsc->suggestDomainCorrection(toTest).compare(toTest) == 0, @"%s must not be corrected", toTest.c_str()); 41 | 42 | toTest = "hello@"; 43 | XCTAssert(edsc->suggestDomainCorrection(toTest).compare(toTest) == 0, @"%s must not be corrected", toTest.c_str()); 44 | 45 | toTest = "@"; 46 | XCTAssert(edsc->suggestDomainCorrection(toTest).compare(toTest) == 0, @"%s must not be corrected", toTest.c_str()); 47 | 48 | toTest = ""; 49 | XCTAssert(edsc->suggestDomainCorrection(toTest).compare(toTest) == 0, @"%s must not be corrected", toTest.c_str()); 50 | 51 | toTest = "@hello"; 52 | XCTAssert(edsc->suggestDomainCorrection(toTest).compare(toTest) == 0, @"%s must not be corrected", toTest.c_str()); 53 | 54 | toTest = "@hello.com"; 55 | XCTAssert(edsc->suggestDomainCorrection(toTest).compare(toTest) == 0, @"%s must not be corrected", toTest.c_str()); 56 | 57 | toTest = "kikoo@gmail.com"; 58 | XCTAssert(edsc->suggestDomainCorrection(toTest).compare(toTest) == 0, @"%s must not be corrected", toTest.c_str()); 59 | 60 | toTest = "kikoo@azdoij.cm"; 61 | XCTAssert(edsc->suggestDomainCorrection("kikoo@azdoij.cm").compare(toTest) == 0, @"%s must not be corrected", toTest.c_str()); 62 | 63 | // Expected suggestions 64 | XCTAssert(edsc->suggestDomainCorrection("hello@gmial.com").compare("hello@gmail.com") == 0); 65 | XCTAssert(edsc->suggestDomainCorrection("hello@gmai.com").compare("hello@gmail.com") == 0); 66 | XCTAssert(edsc->suggestDomainCorrection("hello@yohoo.com").compare("hello@yahoo.com") == 0); 67 | XCTAssert(edsc->suggestDomainCorrection("hello@yhoo.com").compare("hello@yahoo.com") == 0); 68 | XCTAssert(edsc->suggestDomainCorrection("hello@ayhoo.com").compare("hello@yahoo.com") == 0); 69 | XCTAssert(edsc->suggestDomainCorrection("hello@yhoo.com").compare("hello@yahoo.com") == 0); 70 | XCTAssert(edsc->suggestDomainCorrection("hello@outloo.com").compare("hello@outlook.com") == 0); 71 | XCTAssert(edsc->suggestDomainCorrection("hello@comcats.com").compare("hello@comcast.com") == 0); 72 | 73 | 74 | // private tests 75 | /* 76 | NSLog(@"TEST: %s", edsc->suggest("gmail.com").c_str()); 77 | NSLog(@"TEST: %s", edsc->suggest("gamail.com").c_str()); 78 | NSLog(@"TEST: %s", edsc->suggest("gmial.com").c_str()); 79 | NSLog(@"TEST: %s", edsc->suggest("gmaiil.cm").c_str()); 80 | */ 81 | } 82 | 83 | @end 84 | -------------------------------------------------------------------------------- /ios/EmailCheckerTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | --------------------------------------------------------------------------------