Skip to content

Commit

Permalink
#168 modify service code
Browse files Browse the repository at this point in the history
  • Loading branch information
chad1994 committed Dec 1, 2018
1 parent 7bcbc20 commit 7f618d9
Show file tree
Hide file tree
Showing 12 changed files with 97 additions and 71 deletions.
14 changes: 13 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ android {
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8

}
dataBinding {
enabled = true
}
}

Expand Down Expand Up @@ -62,6 +66,8 @@ dependencies {
implementation 'com.google.code.gson:gson:2.6.1'
implementation "com.squareup.retrofit2:adapter-rxjava2:2.4.0"



//Permission
implementation 'gun0912.ted:tedpermission:2.0.0'
// Dali Van Picasso ~~ 밤 고흐의 달이 보이는밤~
Expand All @@ -79,18 +85,24 @@ dependencies {
// Google Firebase
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
// GA


implementation files('libs/com.skt.Tmap_1.53.jar')

// Butter knife
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

// AWS
implementation ('com.amazonaws:aws-android-sdk-mobile-client:2.6.15@aar') { transitive = true }
implementation('com.amazonaws:aws-android-sdk-mobile-client:2.6.15@aar') { transitive = true }
implementation 'com.amazonaws:aws-android-sdk-s3:2.6.+'
implementation 'com.amazonaws:aws-android-sdk-cognito:2.6.+'

implementation 'id.zelory:compressor:2.1.0'



}

apply plugin: 'com.google.gms.google-services'
42 changes: 0 additions & 42 deletions app/google-services.json

This file was deleted.

44 changes: 26 additions & 18 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />

<application
android:name=".HanRiverMeetupApplication"
android:usesCleartextTraffic="true"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">

<meta-data
android:name="com.google.android.geo.API_KEY"
Expand All @@ -28,6 +28,10 @@
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id" />

<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.depromeet.hanriver.hanrivermeetup"
Expand All @@ -38,23 +42,27 @@
android:resource="@xml/file_path" />
</provider>

<activity android:name=".activity.SplashActivity"
<activity
android:name=".activity.SplashActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activity.login.LoginActivity"
android:screenOrientation="portrait"/>
<activity android:name=".activity.main.MainActivity"
android:screenOrientation="portrait"/>
<activity
android:name=".activity.login.LoginActivity"
android:screenOrientation="portrait" />
<activity
android:name=".activity.main.MainActivity"
android:screenOrientation="portrait">

</activity>
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name"
/>
android:label="@string/app_name" />
<activity
android:name="com.facebook.CustomTabActivity"
android:exported="true"
Expand All @@ -70,18 +78,18 @@
</activity>

<service
android:exported="false"
android:name=".firebase.CustomFirebaseMessagingService">
android:name=".firebase.CustomFirebaseMessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>

<service
android:exported="false"
android:name=".firebase.CustomFirebaseInstanceIDService">
android:name=".firebase.CustomFirebaseInstanceIDService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ public class HanRiverMeetupApplication extends Application {
@NonNull
private final IMeetingListInnerDataModel mEtcDataModel;

// private static GoogleAnalytics sAnalytics;
// private static Tracker sTracker;


public static HanRiverMeetupApplication getInstance(){
return hanRiverMeetupApplication;
Expand All @@ -90,6 +93,7 @@ public static HanRiverMeetupApplication getInstance(){
public void onCreate() {
super.onCreate();
hanRiverMeetupApplication = this;
// sAnalytics = GoogleAnalytics.getInstance(this);
setPreferences();
}

Expand Down Expand Up @@ -179,7 +183,6 @@ public IMeetingListInnerDataModel getEtcDataModel() {
return mEtcDataModel;
}


// @NonNull
// public ICreateRoomDataModel getCreateRoomDataModel(){
// return mCreateRoomDataModel;
Expand Down Expand Up @@ -288,9 +291,16 @@ public void run() {
}
}, 1500);
}

}
}

// synchronized public Tracker getDefaultTracker() {
// if (sTracker == null) {
// sTracker = sAnalytics.newTracker(R.xml.global_tracker);
// }
//
// return sTracker;
// }


}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
import android.widget.Toast;

import com.amazonaws.mobile.client.AWSMobileClient;
import com.depromeet.hanriver.hanrivermeetup.HanRiverMeetupApplication;
import com.depromeet.hanriver.hanrivermeetup.R;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.gun0912.tedpermission.PermissionListener;
import com.gun0912.tedpermission.TedPermission;

Expand Down Expand Up @@ -48,11 +50,15 @@ public class MainActivity extends AppCompatActivity {
"어디로강",
"마이한강",
};

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

FirebaseAnalytics analytics = FirebaseAnalytics.getInstance(this);


//Permission Check
PermissionListener permissionlistener = new PermissionListener() {
@Override
Expand Down Expand Up @@ -98,6 +104,7 @@ public void onPermissionDenied(ArrayList<String> deniedPermissions) {

// Initializing ViewPager
viewPager = findViewById(R.id.viewpager);
viewPager.setOffscreenPageLimit(3);
viewPager.setOverScrollMode(View.OVER_SCROLL_NEVER);

// Creating TabPagerAdapter adapter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.depromeet.hanriver.hanrivermeetup.activity.main.MainActivity;
import com.depromeet.hanriver.hanrivermeetup.HanRiverMeetupApplication;
Expand All @@ -26,6 +27,8 @@

import java.util.List;

import javax.net.ssl.HttpsURLConnection;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.schedulers.Schedulers;
Expand Down Expand Up @@ -105,10 +108,19 @@ private void bind() {
mCompositeDisposable.add(WeatherService.getInstance().getWeather()
.subscribeOn(Schedulers.computation())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::setWeather));
.doOnNext(res->{
if (res.code() == HttpsURLConnection.HTTP_OK) {
setWeather(res.body());
} else {
Toast.makeText(getContext(), "날씨정보 호출 과정에서 오류가 발생했습니다.", Toast.LENGTH_SHORT).show();
}
})
.subscribe());

}



private void unBind() {
mCompositeDisposable.clear();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.depromeet.hanriver.hanrivermeetup.R;
import com.depromeet.hanriver.hanrivermeetup.fragment.timeline.Adapter.TimeLineAdapter;
Expand All @@ -34,6 +35,8 @@
import java.util.Locale;
import java.util.concurrent.TimeUnit;

import javax.net.ssl.HttpsURLConnection;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
Expand Down Expand Up @@ -176,7 +179,14 @@ private void bind() {
mCompositeDisposable.add(WeatherService.getInstance().getWeather()
.subscribeOn(Schedulers.computation())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::setWeather));
.doOnNext(res->{
if (res.code() == HttpsURLConnection.HTTP_OK) {
setWeather(res.body());
} else {
Toast.makeText(getContext(), "날씨정보 호출 과정에서 오류가 발생했습니다.", Toast.LENGTH_SHORT).show();
}
})
.subscribe());

mCompositeDisposable.add(EventService.getInstance().getEvents()
.subscribeOn(Schedulers.computation())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@


import io.reactivex.Observable;
import retrofit2.Response;
import retrofit2.http.GET;

public interface WeatherAPIService {

@GET("weather/")
Observable<Weather> getWeather();
Observable<Response<Weather>> getWeather();

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
import com.depromeet.hanriver.hanrivermeetup.network.APIUtiles;
import com.depromeet.hanriver.hanrivermeetup.network.WeatherAPIService;

import javax.net.ssl.HttpsURLConnection;

import io.reactivex.Observable;
import io.reactivex.schedulers.Schedulers;
import retrofit2.Response;

public class WeatherService {
private static final WeatherService ourInstance = new WeatherService();
Expand All @@ -21,9 +24,14 @@ public void setService(String token,String id){
mService = APIUtiles.getWeatherService(token,id);
}

public Observable<Weather> getWeather(){
public Observable<Response<Weather>> getWeather(){
return mService.getWeather()
.subscribeOn(Schedulers.io());
.subscribeOn(Schedulers.io())
.doOnNext( res -> {
if(res.code() == HttpsURLConnection.HTTP_OK){
res.body();
}
});
}

}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.0.1'

// NOTE: Do not place your application dependencies here; they belong
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Jun 17 21:35:16 KST 2018
#Wed Nov 21 18:03:44 KST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
Binary file added 심심한강.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7f618d9

Please sign in to comment.