This library is deprecated.
For Android please check out EmailChecker-Android
For iOS please check out EmailTypoChecker.swift
This library helps to catch simple email domain typos. Its intended to be used as a hint when a user have to enter an email address.
The library is written in C++ and is inspired by the algorithm described here: http://norvig.com/spell-correct.html (Warning, it's not the exact same algo).
Currently gradle doesn't support NDK, so we used a trick to make it work: it generates a temporary .jar file containing .so, this file is used as a jar dependency for the final .aar file.
If you want to use it in your Android project, your can add it as a library in your build.gradle file, don't forget to add the wordpress-mobile maven repository. For instance:
repositories {
maven { url 'http://wordpress-mobile.github.io/WordPress-Android' }
}
dependencies {
// use the latest 0.x version
compile 'org.wordpress:emailchecker:0.+'
}
Sample usage:
String emailToCheck = "salut@gmial.com";
String suggest = (new EmailChecker()).suggestDomainCorrection(email);
if (suggest.compareTo(email) != 0) {
Log.v("FIXME", "did you mean: " + suggest + " ?");
}
If you use CocoaPods, you just have to add the following pod to your dependency list:
pod 'EmailChecker', :podspec => 'https://raw.github.com/wordpress-mobile/EmailChecker/master/ios/EmailChecker.podspec'
Sample usage:
NSString *emailToCheck = @"salut@gmial.com";
NSString *suggestedEmail = [EmailChecker suggestDomainCorrection: @"salut@gmial.com"];
if (![suggestedEmail isEqualToString:emailToCheck]) {
NSLog(@"Did you mean: %@", suggestedEmail);
}
|-- common # common C++ native code
|-- android
| |-- jni # android specific C++ native code
| `-- src # android specific Java code
`-- ios
|-- EmailChecker # iOS specific Obj-C++ code
`-- EmailCheckerTests # Obj-C++ tests (testing C++ code in common/)
- Create the public method in common/
- Wrap it as a Java jni method in android/jni and android/java
- Wrap it as a Obj-C++ method in ios/EmailChecker/
-
For Android
$ cd android && gradle build
-
For iOS
$ cd ios && xcodebuild
This library is dual licensed unded MIT and GPL v2.
- Failback to the identity function when native libraries can't be loaded (weird Android ROMs).
- Update to gradle-android 0.8 and use gradle to build jni code
- Initial release