Skip to content

Commit 95c5152

Browse files
committed
asd
1 parent 90c23b3 commit 95c5152

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

src/android/InstagramAuth.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,16 @@ public void onFail(String error) {
7878
intent.setData(Uri.parse(id));
7979
intent.setPackage("com.instagram.android");
8080
this.cordova.getActivity().startActivity(intent);
81-
/*PackageManager pm = this.cordova.getActivity().getApplicationContext().getPackageManager();
81+
82+
callbackContext.success();
83+
return true;
84+
}else if("openApp".equals(action)){
85+
PackageManager pm = this.cordova.getActivity().getApplicationContext().getPackageManager();
8286
Intent appStartIntent = pm.getLaunchIntentForPackage("com.instagram.android");
8387
if (null != appStartIntent)
8488
{
8589
this.cordova.getActivity().getApplicationContext().startActivity(appStartIntent);
86-
}*/
90+
}
8791
callbackContext.success();
8892
return true;
8993
}

www/instaauth.js

+13-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
var exec = require('cordova/exec');
1+
var exec = require('cordova/exec');
22

3-
Instagram = {
4-
auth:function(suc,fail){
5-
return exec(suc,fail, "InstagramAuth", "auth", []);
6-
},
7-
open:function(id,suc,fail){
8-
return exec(suc,fail, "InstagramAuth", "open", [id]);
3+
Instagram = {
4+
auth: function (suc, fail) {
5+
return exec(suc, fail, "InstagramAuth", "auth", []);
6+
},
7+
open: function (id, suc, fail) {
8+
if (id)
9+
return exec(suc, fail, "InstagramAuth", "open", [id]);
10+
else
11+
return exec(suc, fail, "InstagramAuth", "openApp", []);
12+
13+
}
914
}
10-
}
11-
module.exports = Instagram;
15+
module.exports = Instagram;

0 commit comments

Comments
 (0)