Skip to content

Commit

Permalink
Merge pull request #686 from jberkel/upgrade-k9
Browse files Browse the repository at this point in the history
Upgrade to K9mail-libary head
  • Loading branch information
jberkel authored Oct 21, 2016
2 parents 20949b1 + 24bd8f1 commit a4e1a22
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 28 deletions.
21 changes: 10 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
language: java
before_install:
# download the latest android sdk and unzip
- sudo apt-get update -qq
- if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch; fi
- wget http://dl.google.com/android/android-sdk_r23.0.2-linux.tgz
- tar xzf android-sdk_r23.0.2-linux.tgz
- export ANDROID_HOME=`pwd`/android-sdk-linux
- export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
- echo y | android update sdk --filter platform-tools,build-tools-19.1.0,android-21 --no-ui --force --all
install: mvn install -DskipTests=true -e
language: android
android:
components:
- tools
- build-tools-24.0.3
- android-24
- extra-android-m2repository

jdk: oraclejdk8

script:
- mvn android:lint
- mvn test
Expand Down
11 changes: 8 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<groupId>com.fsck.k9.mail</groupId>
<artifactId>lib</artifactId>
<type>aar</type>
<version>0.0.1.f2ef921</version>
<version>0.0.1.75bb293</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -107,13 +107,13 @@
<plugin>
<groupId>com.simpligility.maven.plugins</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>4.4.1</version>
<version>4.4.3</version>
<configuration>
<androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
<assetsDirectory>${project.basedir}/assets</assetsDirectory>
<resourceDirectory>${project.basedir}/res</resourceDirectory>
<sdk>
<platform>21</platform>
<platform>24</platform>
</sdk>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
<lint>
Expand Down Expand Up @@ -229,6 +229,11 @@
</snapshots>
</repository>

<repository>
<id>android-local</id>
<url>file:///${env.ANDROID_HOME}/extras/android/m2repository</url>
</repository>

<repository>
<id>zegoggles-snapshots</id>
<name>zeggogles snapshots</name>
Expand Down
12 changes: 5 additions & 7 deletions src/main/java/com/zegoggles/smssync/mail/Headers.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@ public final class Headers {
private Headers() {}

public static String get(Message msg, String header) {
try {
String[] hdrs = msg.getHeader(header);
if (hdrs != null && hdrs.length > 0) {
return hdrs[0];
}
} catch (MessagingException ignored) {
String[] hdrs = msg.getHeader(header);
if (hdrs.length > 0) {
return hdrs[0];
} else {
return null;
}
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ public MessageGenerator(Context context,
sentDate = new Date();
}
mHeaderGenerator.setHeaders(msg, msgMap, DataType.SMS, address, record, sentDate, messageType);
msg.setUsing7bitTransport();
return msg;
}

Expand Down Expand Up @@ -141,14 +140,13 @@ public MessageGenerator(Context context,
}
final int msg_box = toInt(msgMap.get("msg_box"));
mHeaderGenerator.setHeaders(msg, msgMap, DataType.MMS, details.address, details.getRecipient(), sentDate, msg_box);
MimeMultipart body = new MimeMultipart();
MimeMultipart body = MimeMultipart.newInstance();

for (BodyPart p : mMmsSupport.getMMSBodyParts(Uri.withAppendedPath(mmsUri, MMS_PART))) {
body.addBodyPart(p);
}

setBody(msg, body);
msg.setUsing7bitTransport();
return msg;
}

Expand Down Expand Up @@ -195,7 +193,6 @@ public MessageGenerator(Context context,
sentDate = new Date();
}
mHeaderGenerator.setHeaders(msg, msgMap, DataType.CALLLOG, address, record, sentDate, callType);
msg.setUsing7bitTransport();
return msg;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.Map;

import static org.fest.assertions.api.Assertions.assertThat;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

Expand All @@ -23,6 +24,7 @@ public class ConversionResultTest {
@Test public void shouldAddMessage() throws Exception {
ConversionResult result = new ConversionResult(DataType.SMS);
Message message = mock(Message.class);
when(message.getHeader(anyString())).thenReturn(new String[] {});
Map<String, String> map = new HashMap<String, String>();
result.add(message, map);
assertThat(result.isEmpty()).isFalse();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void testMessageToContentValuesWithUnknownMessageTypeGetParsedAsSMS() thr
"\n" +
"Some Text";

final MimeMessage mimeMessage = new MimeMessage(new ByteArrayInputStream(message.getBytes()), true);
final MimeMessage mimeMessage = MimeMessage.parseMimeMessage(new ByteArrayInputStream(message.getBytes()), true);
final ContentValues values = messageConverter.messageToContentValues(mimeMessage);
assertThat(values.getAsString(Telephony.TextBasedSmsColumns.ADDRESS)).isNull();
}
Expand Down Expand Up @@ -194,7 +194,7 @@ private MimeMessage createSMSMessage() throws IOException, MessagingException {
"\n" +
"Das=C3=9FAs=C3=9F";

return new MimeMessage(new ByteArrayInputStream(message.getBytes()), true);
return MimeMessage.parseMimeMessage(new ByteArrayInputStream(message.getBytes()), true);
}

private MimeMessage createCallLogMessage() throws IOException, MessagingException {
Expand All @@ -219,6 +219,6 @@ private MimeMessage createCallLogMessage() throws IOException, MessagingExceptio
"\n" +
"+12121 (missed call)";

return new MimeMessage(new ByteArrayInputStream(message.getBytes()), true);
return MimeMessage.parseMimeMessage(new ByteArrayInputStream(message.getBytes()), true);
}
}

0 comments on commit a4e1a22

Please sign in to comment.