Skip to content

Commit

Permalink
Merge pull request #76 from ApplETS/dev
Browse files Browse the repository at this point in the history
Mise en production ÉTSMobile 2.20
  • Loading branch information
ttauveron authored May 13, 2017
2 parents ac8e405 + ced32cb commit 383c707
Show file tree
Hide file tree
Showing 139 changed files with 5,785 additions and 1,454 deletions.
35 changes: 25 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ apply plugin: 'com.android.application'

repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://github.com/leonardocardoso/mvn-repo/raw/master/maven-deploy' }
}


android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
compileSdkVersion 25
buildToolsVersion '25.0.0'
useLibrary 'org.apache.http.legacy'

lintOptions {
Expand All @@ -40,8 +41,8 @@ android {
applicationId "ca.etsmtl.applets.etsmobile"
minSdkVersion 15
targetSdkVersion 21
versionCode 22
versionName "2.11"
versionCode 23
versionName "2.20"
multiDexEnabled true
}

Expand All @@ -51,6 +52,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

dexOptions {
javaMaxHeapSize "4g"
}
}

dependencies {
Expand All @@ -65,17 +70,21 @@ dependencies {
compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.11'
compile 'joda-time:joda-time:2.3'
compile 'org.joda:joda-convert:1.7'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:appcompat-v7:25.3.1'

compile 'com.android.support:support-v4:25.3.1'
compile('com.crashlytics.sdk.android:crashlytics:2.3.2@aar') {
transitive = true;
}
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services-wearable:8.4.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-gcm:10.0.1'
compile 'com.google.android.gms:play-services-wearable:10.0.1'
compile 'com.google.android.gms:play-services-analytics:10.0.1'

compile 'com.google.android.gms:play-services-base:10.0.1'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'io.supportkit:core:latest.release'
compile 'io.supportkit:ui:latest.release'
compile 'io.smooch:core:latest.release'
compile 'io.smooch:ui:latest.release'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.amazonaws:aws-android-sdk-sns:2.2.5'
compile 'com.amazonaws:aws-android-sdk-core:2.2.5'
Expand All @@ -90,4 +99,10 @@ dependencies {
compile 'com.j256.ormlite:ormlite-core:4.43'
compile 'com.j256.ormlite:ormlite-android:4.43'

compile('com.mikepenz:materialdrawer:5.8.0@aar') {
transitive = true
}
compile 'com.github.markushi:circlebutton:1.1'


}
48 changes: 39 additions & 9 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,16 @@
<uses-permission android:name="android.permission.READ_CALL_LOG" />
<uses-permission android:name="android.permission.WRITE_CALL_LOG" />

<android:uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<application
android:name="ca.etsmtl.applets.etsmobile.ApplicationManager"
android:allowBackup="true"
android:configChanges="locale|layoutDirection"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
android:theme="@style/ETSMobileTheme">

<activity
android:name="ca.etsmtl.applets.etsmobile.ui.activity.MainActivity"
android:configChanges="locale|layoutDirection"
Expand Down Expand Up @@ -88,6 +89,7 @@
android:name="android.support.PARENT_ACTIVITY"
android:value="ca.etsmtl.applets.etsmobile.ui.activity.MainActivity" />
</activity>

<activity
android:name="ca.etsmtl.applets.etsmobile.ui.activity.BottinDetailsActivity"
android:label="@string/title_activity_bottin_details"
Expand Down Expand Up @@ -184,21 +186,49 @@
<!-- [END instanceId_listener] -->
<service
android:name="ca.etsmtl.applets.etsmobile.service.RegistrationIntentService"
android:exported="false"></service>
android:exported="false" />

<meta-data
android:name="io.fabric.ApiKey"
android:value="" />

<service
android:name="ca.etsmtl.applets.etsmobile.service.WearService"
android:enabled="true"
android:exported="true">
android:name="ca.etsmtl.applets.etsmobile.service.WearService">

<intent-filter>
<action android:name="com.google.android.gms.wearable.BIND_LISTENER"/>
</intent-filter>
<action android:name="com.google.android.gms.wearable.MESSAGE_RECEIVED" />
<action android:name="com.google.android.gms.wearable.DATA_CHANGED" />

<data
android:host="*"
android:pathPrefix="/today_req"
android:scheme="wear" />

</intent-filter>
</service>

<receiver
android:name="ca.etsmtl.applets.etsmobile.widget.TodayWidgetProvider">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_ENABLED"/>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
</intent-filter>

<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/today_widget_info" />
</receiver>

<service android:name="ca.etsmtl.applets.etsmobile.widget.TodayWidgetService"
android:permission="android.permission.BIND_REMOTEVIEWS" />

<activity android:name="ca.etsmtl.applets.etsmobile.widget.TodayWidgetConfigureActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
</activity>

</application>

</manifest>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,24 @@
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.res.Configuration;
import android.preference.PreferenceManager;
import android.support.multidex.MultiDex;
import android.text.TextUtils;
import android.util.Log;

import com.crashlytics.android.Crashlytics;

import java.sql.SQLException;
import java.util.LinkedHashMap;
import java.util.Locale;

import ca.etsmtl.applets.etsmobile.db.DatabaseHelper;
import ca.etsmtl.applets.etsmobile.model.Etudiant;
import ca.etsmtl.applets.etsmobile.model.MyMenuItem;
import ca.etsmtl.applets.etsmobile.model.UserCredentials;
import ca.etsmtl.applets.etsmobile.ui.activity.MainActivity;
import ca.etsmtl.applets.etsmobile.ui.fragment.AboutFragment;
import ca.etsmtl.applets.etsmobile.ui.fragment.BandwithFragment;
import ca.etsmtl.applets.etsmobile.ui.fragment.BiblioFragment;
import ca.etsmtl.applets.etsmobile.ui.fragment.BottinFragment;
import ca.etsmtl.applets.etsmobile.ui.fragment.CommentairesFragment;
import ca.etsmtl.applets.etsmobile.ui.fragment.FAQFragment;
import ca.etsmtl.applets.etsmobile.ui.fragment.HoraireFragment;
import ca.etsmtl.applets.etsmobile.ui.fragment.MoodleFragment;
import ca.etsmtl.applets.etsmobile.ui.fragment.NewsFragment;
import ca.etsmtl.applets.etsmobile.ui.fragment.NotesFragment;
import ca.etsmtl.applets.etsmobile.ui.fragment.OtherAppsFragment;
import ca.etsmtl.applets.etsmobile.ui.fragment.ProfilFragment;
import ca.etsmtl.applets.etsmobile.ui.fragment.SecuriteFragment;
import ca.etsmtl.applets.etsmobile.ui.fragment.SponsorsFragment;
import ca.etsmtl.applets.etsmobile.ui.fragment.TodayFragment;
import ca.etsmtl.applets.etsmobile.util.AnalyticsHelper;
import ca.etsmtl.applets.etsmobile.util.Constants;
import ca.etsmtl.applets.etsmobile.util.NoteManager;
import ca.etsmtl.applets.etsmobile.util.ProfilManager;
import ca.etsmtl.applets.etsmobile.util.SecurePreferences;
import ca.etsmtl.applets.etsmobile2.R;
import io.fabric.sdk.android.Fabric;
import io.supportkit.core.SupportKit;
import ca.etsmtl.applets.etsmobile.widget.TodayWidgetProvider;

public class ApplicationManager extends Application {

Expand All @@ -68,7 +44,7 @@ public void onCreate() {
createDatabaseTables();

// SupportKit.init(this, getString(R.string.credentials_supportkit));
Fabric.with(this, new Crashlytics());
// Fabric.with(this, new Crashlytics());

AccountManager accountManager = AccountManager.get(this);
Account[] accounts = accountManager.getAccountsByType(Constants.ACCOUNT_TYPE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,31 +47,18 @@ public AppletsApiCalendarRequest(Context context, String startDate, String endDa
public EventList loadDataFromNetwork() throws Exception {

String url = context.getString(R.string.applets_api_calendar, "ets", startDate, endDate);
// Instantiate the custom HttpClient to call Https request

String apiCredentials = context.getString(R.string.credentials_api);
String basicAuth = "Basic " + Base64.encode(apiCredentials.getBytes());

OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
.url(url)
.get()
.addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.addHeader("authorization", basicAuth)
.build();

Response response = client.newCall(request).execute();

JSONObject result = new JSONObject(response.body().string());
// If the returned value of "data" returned by the API becomes an Array,
// change the type of JSONObject to JSONArray
JSONArray data = result.getJSONObject("data").getJSONArray("ets");

String s = data.toString();

EventList eventList = new Gson().fromJson(s, EventList.class);
String calendarJson = response.body().string();

return eventList;
return new Gson().fromJson(calendarJson, EventList.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package ca.etsmtl.applets.etsmobile.http;

import android.content.Context;

import com.google.gson.Gson;
import com.octo.android.robospice.request.springandroid.SpringAndroidSpiceRequest;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;

import ca.etsmtl.applets.etsmobile.model.applets_events.EvenementCommunaute;
import ca.etsmtl.applets.etsmobile.model.applets_events.EvenementCommunauteList;
import ca.etsmtl.applets.etsmobile.model.applets_events.SourceEvenement;
import ca.etsmtl.applets.etsmobile.model.applets_events.SourceEvenementList;
import ca.etsmtl.applets.etsmobile2.R;

public class AppletsApiEvenementsRequest extends SpringAndroidSpiceRequest<EvenementCommunauteList> {

private Context context;
private SourceEvenement source;

public AppletsApiEvenementsRequest(Context context, SourceEvenement source) {
super(EvenementCommunauteList.class);
this.context = context;
this.source = source;
}

@Override
public EvenementCommunauteList loadDataFromNetwork() throws Exception {

String eventsAddress = context.getString(R.string.applets_api_events, source.getKey());

OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
.url(eventsAddress)
.get()
.build();

Response response = client.newCall(request).execute();

String result = response.body().string();
EvenementCommunauteList evenementList = new Gson().fromJson(result, EvenementCommunauteList.class);

for(EvenementCommunaute event : evenementList) {
event.setSourceEvenement(source);
}

return evenementList;
}

/**
* This method generates a unique cache key for this request. In this case
* our cache key depends just on the keyword.
* @return
*/
public String createCacheKey() {
return "events_"+source.getKey();
}
}
Loading

0 comments on commit 383c707

Please sign in to comment.