Skip to content

Commit c230a19

Browse files
author
Suneet Srivastava
committed
fix: Removed pdk client and fixed pintrest auth and share
1 parent db79b39 commit c230a19

File tree

10 files changed

+325
-125
lines changed

10 files changed

+325
-125
lines changed

app/build.gradle

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ android {
3939
vectorDrawables.useSupportLibrary = true
4040
resConfigs "en"
4141
ndk {
42-
abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
42+
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
4343
}
4444
renderscriptTargetApi 19
4545
renderscriptSupportModeEnabled true
@@ -135,6 +135,7 @@ spotless {
135135

136136
dependencies {
137137
implementation fileTree(include: ['*.jar'], dir: 'libs')
138+
implementation 'androidx.appcompat:appcompat:1.1.0'
138139
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.1.0', {
139140
exclude group: 'com.android.support', module: 'support-annotations'
140141
})
@@ -232,9 +233,6 @@ dependencies {
232233
//opencv
233234
implementation project(':openCV')
234235

235-
//pdk
236-
implementation 'com.github.forkerknights:android-pdk:1.2b'
237-
238236
//compressor
239237
implementation 'id.zelory:compressor:2.1.0'
240238

app/src/main/AndroidManifest.xml

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,39 @@
44
package="org.fossasia.phimpme">
55

66
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
7-
8-
<uses-permission android:name="android.permission.READ_SMS"
9-
tools:node="remove"/>
10-
<uses-permission android:name="android.permission.RECEIVE_SMS"
11-
tools:node="remove"/>
12-
<uses-permission android:name="android.permission.SEND_SMS"
13-
tools:node="remove"/>
14-
<uses-permission android:name="android.permission.WRITE_SMS"
15-
tools:node="remove"/>
16-
<uses-permission android:name="android.permission.CALL_PHONE"
17-
tools:node="remove"/>
18-
<uses-permission android:name="android.permission.WRITE_CALL_LOG"
19-
tools:node="remove"/>
20-
<uses-permission android:name="android.permission.READ_CALL_LOG"
21-
tools:node="remove"/>
22-
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"
23-
tools:node="remove"/>
24-
<uses-permission android:name="android.permission.MANAGE_OWN_CALLS"
25-
tools:node="remove"/>
26-
<uses-permission android:name="android.permission.ANSWER_PHONE_CALLS"
27-
tools:node="remove"/>
28-
<uses-permission android:name="android.permission.READ_PHONE_NUMBERS"
29-
tools:node="remove"/>
30-
7+
<uses-permission
8+
android:name="android.permission.READ_SMS"
9+
tools:node="remove" />
10+
<uses-permission
11+
android:name="android.permission.RECEIVE_SMS"
12+
tools:node="remove" />
13+
<uses-permission
14+
android:name="android.permission.SEND_SMS"
15+
tools:node="remove" />
16+
<uses-permission
17+
android:name="android.permission.WRITE_SMS"
18+
tools:node="remove" />
19+
<uses-permission
20+
android:name="android.permission.CALL_PHONE"
21+
tools:node="remove" />
22+
<uses-permission
23+
android:name="android.permission.WRITE_CALL_LOG"
24+
tools:node="remove" />
25+
<uses-permission
26+
android:name="android.permission.READ_CALL_LOG"
27+
tools:node="remove" />
28+
<uses-permission
29+
android:name="android.permission.PROCESS_OUTGOING_CALLS"
30+
tools:node="remove" />
31+
<uses-permission
32+
android:name="android.permission.MANAGE_OWN_CALLS"
33+
tools:node="remove" />
34+
<uses-permission
35+
android:name="android.permission.ANSWER_PHONE_CALLS"
36+
tools:node="remove" />
37+
<uses-permission
38+
android:name="android.permission.READ_PHONE_NUMBERS"
39+
tools:node="remove" />
3140
<uses-permission android:name="android.permission.CAMERA" />
3241
<uses-permission android:name="android.permission.RECORD_AUDIO" />
3342
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
@@ -46,6 +55,9 @@
4655
android:largeHeap="true"
4756
android:supportsRtl="true"
4857
android:theme="@style/AppTheme">
58+
59+
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
60+
4961
<activity
5062
android:name=".share.twitter.LoginActivity"
5163
android:screenOrientation="portrait">
@@ -60,7 +72,6 @@
6072
android:scheme="phimp.me" />
6173
</intent-filter>
6274
</activity>
63-
6475
<activity
6576
android:name=".opencamera.Camera.CameraActivity"
6677
android:parentActivityName=".gallery.activities.LFMainActivity"
@@ -97,8 +108,7 @@
97108
android:icon="@drawable/ic_launcher_take_photo"
98109
android:label="@string/take_photo"
99110
android:screenOrientation="portrait"
100-
android:taskAffinity="" />
101-
<!-- should not change the android:name, including moving to a subpackage - see http://android-developers.blogspot.co.uk/2011/06/things-that-cannot-change.html -->
111+
android:taskAffinity="" /> <!-- should not change the android:name, including moving to a subpackage - see http://android-developers.blogspot.co.uk/2011/06/things-that-cannot-change.html -->
102112
<receiver
103113
android:name=".opencamera.Camera.MyWidgetProvider"
104114
android:icon="@drawable/ic_launcher_vector"
@@ -114,8 +124,7 @@
114124
<meta-data
115125
android:name="android.appwidget.provider"
116126
android:resource="@xml/widget_info" />
117-
</receiver>
118-
<!-- should not change the android:name, including moving to a subpackage - see http://android-developers.blogspot.co.uk/2011/06/things-that-cannot-change.html -->
127+
</receiver> <!-- should not change the android:name, including moving to a subpackage - see http://android-developers.blogspot.co.uk/2011/06/things-that-cannot-change.html -->
119128
<receiver
120129
android:name=".opencamera.Camera.MyWidgetProviderTakePhoto"
121130
android:icon="@drawable/ic_launcher_take_photo"
@@ -127,8 +136,7 @@
127136
<meta-data
128137
android:name="android.appwidget.provider"
129138
android:resource="@xml/widget_info_take_photo" />
130-
</receiver>
131-
<!-- should not change the android:name, including moving to a subpackage - see http://android-developers.blogspot.co.uk/2011/06/things-that-cannot-change.html -->
139+
</receiver> <!-- should not change the android:name, including moving to a subpackage - see http://android-developers.blogspot.co.uk/2011/06/things-that-cannot-change.html -->
132140
<service
133141
android:name=".opencamera.Camera.MyTileService"
134142
android:icon="@drawable/ic_photo_camera_white_48dp"
@@ -137,8 +145,7 @@
137145
<intent-filter>
138146
<action android:name="android.service.quicksettings.action.QS_TILE" />
139147
</intent-filter>
140-
</service>
141-
<!-- should not change the android:name, including moving to a subpackage - see http://android-developers.blogspot.co.uk/2011/06/things-that-cannot-change.html -->
148+
</service> <!-- should not change the android:name, including moving to a subpackage - see http://android-developers.blogspot.co.uk/2011/06/things-that-cannot-change.html -->
142149
<service
143150
android:name=".opencamera.Camera.MyTileServiceVideo"
144151
android:icon="@drawable/ic_videocam_white_48dp"
@@ -147,8 +154,7 @@
147154
<intent-filter>
148155
<action android:name="android.service.quicksettings.action.QS_TILE" />
149156
</intent-filter>
150-
</service>
151-
<!-- should not change the android:name, including moving to a subpackage - see http://android-developers.blogspot.co.uk/2011/06/things-that-cannot-change.html -->
157+
</service> <!-- should not change the android:name, including moving to a subpackage - see http://android-developers.blogspot.co.uk/2011/06/things-that-cannot-change.html -->
152158
<service
153159
android:name=".opencamera.Camera.MyTileServiceFrontCamera"
154160
android:icon="@drawable/ic_face_white_48dp"
@@ -211,9 +217,9 @@
211217
android:name=".gallery.activities.SingleMediaActivity"
212218
android:configChanges="orientation|screenSize|uiMode|touchscreen|screenLayout"
213219
android:label="@string/app_name"
214-
android:windowSoftInputMode="adjustPan"
215220
android:parentActivityName=".gallery.activities.LFMainActivity"
216-
android:theme="@style/Theme.AppCompat.NoActionBar">
221+
android:theme="@style/Theme.AppCompat.NoActionBar"
222+
android:windowSoftInputMode="adjustPan">
217223
<intent-filter>
218224
<action android:name="android.intent.action.SEND" />
219225

@@ -255,9 +261,9 @@
255261
<activity
256262
android:name=".gallery.activities.SettingsActivity"
257263
android:configChanges="orientation|screenSize"
258-
android:windowSoftInputMode="adjustNothing"
259264
android:label="@string/settings"
260-
android:theme="@style/Theme.AppCompat.NoActionBar">
265+
android:theme="@style/Theme.AppCompat.NoActionBar"
266+
android:windowSoftInputMode="adjustNothing">
261267
<intent-filter>
262268
<action android:name="android.intent.action.SETTING" />
263269

@@ -269,14 +275,11 @@
269275
<category android:name="android.intent.category.DEFAULT" />
270276
</intent-filter>
271277
</activity>
272-
273278
<activity
274279
android:name=".gallery.activities.AboutActivity"
275280
android:configChanges="orientation|screenSize"
276281
android:label="@string/about"
277-
android:theme="@style/Theme.AppCompat.NoActionBar">
278-
</activity>
279-
282+
android:theme="@style/Theme.AppCompat.NoActionBar"></activity>
280283
<activity
281284
android:name=".gallery.activities.ExcludedAlbumsActivity"
282285
android:label="@string/excluded_albums"
@@ -290,10 +293,7 @@
290293
<activity
291294
android:name=".editor.EditImageActivity"
292295
android:theme="@style/AppTheme.NoActionBar"
293-
294-
android:windowSoftInputMode="adjustPan"
295-
/>
296-
296+
android:windowSoftInputMode="adjustPan" />
297297
<activity
298298
android:name="com.yalantis.ucrop.UCropActivity"
299299
android:screenOrientation="portrait"
@@ -327,7 +327,6 @@
327327
android:screenOrientation="portrait"
328328
android:theme="@style/AppTheme.NoActionBar"
329329
android:windowSoftInputMode="adjustNothing" />
330-
331330
<activity
332331
android:name=".accounts.AccountActivity"
333332
android:launchMode="singleTask"
@@ -392,8 +391,9 @@
392391
android:name="io.fabric.ApiKey"
393392
android:value="78c6ec5c18fcd10ffbfd28ae038f3311f2763889" />
394393

395-
<activity android:name=".editor.CompressImageActivity"></activity>
396-
<activity android:name=".trashbin.TrashBinActivity"></activity>
394+
<activity android:name=".editor.CompressImageActivity" />
395+
<activity android:name=".trashbin.TrashBinActivity" />
396+
<activity android:name=".share.pinterest.PinterestAuthActivity" />
397397
</application>
398398

399-
</manifest>
399+
</manifest>

app/src/main/java/org/fossasia/phimpme/accounts/AccountActivity.java

Lines changed: 39 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.fossasia.phimpme.accounts;
22

3-
import static com.pinterest.android.pdk.PDKClient.setDebugMode;
43
import static org.fossasia.phimpme.R.string.no_account_signed_in;
54
import static org.fossasia.phimpme.data.local.AccountDatabase.AccountName.BOX;
65
import static org.fossasia.phimpme.data.local.AccountDatabase.AccountName.DROPBOX;
@@ -36,10 +35,6 @@
3635
import com.box.androidsdk.content.models.BoxSession;
3736
import com.dropbox.core.android.Auth;
3837
import com.google.android.material.bottomnavigation.BottomNavigationView;
39-
import com.pinterest.android.pdk.PDKCallback;
40-
import com.pinterest.android.pdk.PDKClient;
41-
import com.pinterest.android.pdk.PDKException;
42-
import com.pinterest.android.pdk.PDKResponse;
4338
import com.twitter.sdk.android.core.identity.TwitterAuthClient;
4439
import io.realm.Realm;
4540
import io.realm.RealmQuery;
@@ -58,6 +53,7 @@
5853
import org.fossasia.phimpme.share.imgur.ImgurAuthActivity;
5954
import org.fossasia.phimpme.share.nextcloud.NextCloudAuth;
6055
import org.fossasia.phimpme.share.owncloud.OwnCloudActivity;
56+
import org.fossasia.phimpme.share.pinterest.PinterestAuthActivity;
6157
import org.fossasia.phimpme.share.twitter.LoginActivity;
6258
import org.fossasia.phimpme.utilities.ActivitySwitchHelper;
6359
import org.fossasia.phimpme.utilities.BasicCallBack;
@@ -98,7 +94,7 @@ public class AccountActivity extends ThemedActivity
9894
private AccountDatabase account;
9995
private DatabaseHelper databaseHelper;
10096
private Context context;
101-
private PDKClient pdkClient;
97+
// private PDKClient pdkClient;
10298
// private GoogleApiClient mGoogleApiClient;
10399
private BoxSession sessionBox;
104100

@@ -125,9 +121,9 @@ public void onCreate(Bundle savedInstanceState) {
125121
accountPresenter.loadFromDatabase(); // Calling presenter function to load data from database
126122
getSupportActionBar().setTitle(R.string.title_account);
127123
phimpmeProgressBarHandler.show();
128-
pdkClient = PDKClient.configureInstance(this, PINTEREST_APP_ID);
129-
pdkClient.onConnect(this);
130-
setDebugMode(true);
124+
// pdkClient = PDKClient.configureInstance(this, PINTEREST_APP_ID);
125+
// pdkClient.onConnect(this);
126+
// setDebugMode(true);
131127
// googleApiClient();
132128
configureBoxClient();
133129
}
@@ -380,38 +376,39 @@ public void callBack(int status, Object data) {
380376
}
381377

382378
private void signInPinterest() {
383-
ArrayList<String> scopes = new ArrayList<>();
384-
scopes.add(PDKClient.PDKCLIENT_PERMISSION_READ_PUBLIC);
385-
scopes.add(PDKClient.PDKCLIENT_PERMISSION_WRITE_PUBLIC);
386-
scopes.add(PDKClient.PDKCLIENT_PERMISSION_READ_RELATIONSHIPS);
387-
scopes.add(PDKClient.PDKCLIENT_PERMISSION_WRITE_RELATIONSHIPS);
388-
389-
pdkClient.login(
390-
this,
391-
scopes,
392-
new PDKCallback() {
393-
@Override
394-
public void onSuccess(PDKResponse response) {
395-
Log.d(getClass().getName(), response.getData().toString());
396-
realm.beginTransaction();
397-
account = realm.createObject(AccountDatabase.class, PINTEREST.toString());
398-
account.setAccountname(PINTEREST);
399-
account.setUsername(
400-
response.getUser().getFirstName() + " " + response.getUser().getLastName());
401-
realm.commitTransaction();
402-
finish();
403-
startActivity(getIntent());
404-
SnackBarHandler.create(coordinatorLayout, getString(R.string.account_logged_pinterest))
405-
.show();
406-
}
407-
408-
@Override
409-
public void onFailure(PDKException exception) {
410-
Log.e(getClass().getName(), exception.getDetailMessage());
411-
SnackBarHandler.create(coordinatorLayout, getString(R.string.pinterest_signIn_fail))
412-
.show();
413-
}
414-
});
379+
startActivity(new Intent(this, PinterestAuthActivity.class));
380+
// ArrayList<String> scopes = new ArrayList<>();
381+
// scopes.add(PDKClient.PDKCLIENT_PERMISSION_READ_PUBLIC);
382+
// scopes.add(PDKClient.PDKCLIENT_PERMISSION_WRITE_PUBLIC);
383+
// scopes.add(PDKClient.PDKCLIENT_PERMISSION_READ_RELATIONSHIPS);
384+
// scopes.add(PDKClient.PDKCLIENT_PERMISSION_WRITE_RELATIONSHIPS);
385+
//
386+
// pdkClient.login(
387+
// this,
388+
// scopes,
389+
// new PDKCallback() {
390+
// @Override
391+
// public void onSuccess(PDKResponse response) {
392+
// Log.d(getClass().getName(), response.getData().toString());
393+
// realm.beginTransaction();
394+
// account = realm.createObject(AccountDatabase.class, PINTEREST.toString());
395+
// account.setAccountname(PINTEREST);
396+
// account.setUsername(
397+
// response.getUser().getFirstName() + " " + response.getUser().getLastName());
398+
// realm.commitTransaction();
399+
// finish();
400+
// startActivity(getIntent());
401+
// SnackBarHandler.create(coordinatorLayout, getString(R.string.account_logged_pinterest))
402+
// .show();
403+
// }
404+
//
405+
// @Override
406+
// public void onFailure(PDKException exception) {
407+
// Log.e(getClass().getName(), exception.getDetailMessage());
408+
// SnackBarHandler.create(coordinatorLayout, getString(R.string.pinterest_signIn_fail))
409+
// .show();
410+
// }
411+
// });
415412
}
416413

417414
@Override
@@ -530,7 +527,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
530527
super.onActivityResult(requestCode, resultCode, data);
531528
client.onActivityResult(requestCode, resultCode, data);
532529
// callbackManager.onActivityResult(requestCode, resultCode, data);
533-
pdkClient.onOauthResponse(requestCode, resultCode, data);
530+
// pdkClient.onOauthResponse(requestCode, resultCode, data);
534531

535532
if ((requestCode == OWNCLOUD_REQUEST_CODE && resultCode == RESULT_OK)
536533
|| (requestCode == NEXTCLOUD_REQUEST_CODE && resultCode == RESULT_OK)) {

0 commit comments

Comments
 (0)