Skip to content

Commit

Permalink
Test cordova socialshare plugin options
Browse files Browse the repository at this point in the history
  • Loading branch information
esurface committed Dec 20, 2023
1 parent 9972fea commit df47d34
Showing 1 changed file with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export class AttendanceDashboardComponent implements OnInit {
curriculum: any;
units: string[] = []
ignoreCurriculumsForTracking: boolean = false
enableContactChoosing: boolean = false
reportLocaltime: string;
currArray: any[]
enabledClasses: any[]
Expand Down Expand Up @@ -217,13 +216,12 @@ export class AttendanceDashboardComponent implements OnInit {
// sms.send(phone, message, options, success, error);

let options = {
// message: _TRANSLATE('Share this '), // not supported on some apps (Facebook, Instagram)
message: message, // not supported on some apps (Facebook, Instagram)
subject: _TRANSLATE('Student feedback '), // fi. for email
chooserTitle: _TRANSLATE('Pick an app '), // Android only, you can override the default share sheet title
phone: phone, // phone number to share (for WhatsApp only)
number: phone, // phone number to share (for WhatsApp only) unused. delete.
appPackageName: 'com.whatsapp' // Android only, you can provide id of the App you want to share with
// number: phone, // phone number to share (for WhatsApp only) unused. delete.
// appPackageName: 'com.whatsapp' // Android only, you can provide id of the App you want to share with
};

const onSuccess = (result) => {
Expand All @@ -235,11 +233,8 @@ export class AttendanceDashboardComponent implements OnInit {
console.log("Sharing failed with message: " + msg);
alert( _TRANSLATE('Sharing failed: WhatsApp may not be installed. The following apps are available for sharing: ') + msg);
};
if (this.enableContactChoosing) {
this.window.plugins.socialsharing.shareWithOptions(options, onSuccess, onError);
} else {
this.window.plugins.socialsharing.shareViaWhatsAppToPhone(phone, message, null /* img */, null /* url */, onSuccess, onError)
}
this.window.plugins.socialsharing.shareWithOptions(options, onSuccess, onError);

}
} else {
alert(_TRANSLATE('This feature is only available on a mobile device.'))
Expand All @@ -257,8 +252,4 @@ export class AttendanceDashboardComponent implements OnInit {

getClassTitle = this.dashboardService.getClassTitle

setEnableContactChoosing(checked: boolean) {
this.enableContactChoosing = checked
}

}

0 comments on commit df47d34

Please sign in to comment.