EmailChecker 0.1

EmailChecker 0.1

TestsTested
LangLanguage C++C++
License MIT
ReleasedLast Release Dec 2014

Maintained by Unclaimed.


Downloads

Total9,500
Week0
Month0

Installs

Apps40
Test Targets2
powered by Segment

GitHub

Stars45
Watchers14
Forks8
Issues0
Contributors2
Pull Requests0

Code

Files4
LOCLines of Code 95


  • By
  • Maxime Biais

Email Checker for Android and iOS

Introduction

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).

How to use it in an Android project

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, for instance:

dependencies {
    compile 'org.wordpress:emailchecker:0.1'
}

Sample usage:

String emailToCheck = "[email protected]";
String suggest = (new EmailChecker()).suggestDomainCorrection(email);
if (suggest.compareTo(email) != 0) {
    Log.v("FIXME", "did you mean: " + suggest + " ?");
}

How to use it in an iOS project

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 = @"[email protected]";
NSString *suggestedEmail = [EmailChecker suggestDomainCorrection: @"[email protected]"];
if (![suggestedEmail isEqualToString:emailToCheck]) {
    NSLog(@"Did you mean: %@", suggestedEmail);
}

Directory structure

|-- common                  # common native code
|-- android
|   |-- jni                 # android specific native code
|   `-- src                 # android specific java code
`-- ios
    |-- EmailChecker        # ios specific code
    `-- EmailCheckerTests   # tests

Apps that use this library

WordPress for Android

Screenshot from WordPress Android

WordPress for iOS

Screenshot from WordPress Android

LICENSE

This library is dual licensed unded MIT and GPL v2.