titanium send tweets from within my app [closed] - twitter

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I've been trying to social features to my app, recently working on sending tweets, I created a twitter application and trying to use birdhouse.js. I get "authorize application" popup, when I click it I get forwarded to another page that displays a pin "from twitter", but no tweets are sent :(
My code is below:
Ti.include('lib/birdhouse.js');
//create your twitter session and post a tweet
function postToTwitter() {
var BH = new BirdHouse({
consumer_key : "*****************",
consumer_secret : "*****************",
});
if (!BH.authorized) {
//call the birdhouse authorize() method
BH.authorize();
} else {
message = 'test test test';
BH.tweet(message, function() {
alertDialog = Ti.UI.createAlertDialog({
message : 'Tweet posted!'
});
alertDialog.show();
});
}
}
var buttonTwitter = Titanium.UI.createButton({
width : 280,
height : 35,
top : 375,
left : 20,
title : 'Send Via Twitter'
});
buttonTwitter.addEventListener('click', function(e) {
postToTwitter();
});
win1 = Ti.UI.createWindow({
height : '480',
width : '100%',
});
win1.add(buttonTwitter);
win1.open();

Have u tried this code
https://github.com/aaronksaunders/test_social
thanks

Related

C in Swift Project [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed last month.
Improve this question
I'm not too familiar with trying to use C functions from an external library in a Swift project.
I have the following code (commented with the necessary typedefs):
func sadp40() {
let start: Int32 = SADP_Start_V40(SadpDataCallBack, 0, nil) // <-- Error occurs here.
}
func SadpDataCallBack(lpDeviceInfo: SADP_DEVICE_INFO_V40?, pUserData: UnsafeMutableRawPointer) -> () {
// debugPrint(lpDeviceInfoV40?.struSadpDeviceInfo.szIPv4Address as Any)
}
/*
typedef void (CALLBACK *PDEVICE_FIND_CALLBACK_V40)(const SADP_DEVICE_INFO_V40 *lpDeviceInfo, void *pUserData);
CSADP_API BOOL CALLBACK SADP_Start_V40(PDEVICE_FIND_CALLBACK_V40 pDeviceFindCallBack, int bInstallNPF, void* pUserData);
*/
In the function sadp40() I'm receiving a Type of expression is ambiguous without more context error but I'm not sure how to fix it or why it is occurring.
Edit:
Option + Click in XCode:

Fullcalendar(angular) terrible performance on iPhone [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I've used fullcalendar package in angular to show events for a month. Both date and events can be clicked and there is a function to handle both date click and event click. It works fine in desktop and android phones but the issue is in iPhone, there is a significant delay on each date/event click. After tapping on an event it takes some time to render the selection.
I have noticed that eventContent was being called every time on event click and it is called multiple times, and sometimes get the following warnings,
[Violation] 'setInterval' handler took 52ms
[Violation] 'setTimeout' handler took 66ms
[Violation] Forced reflow while executing JavaScript took 31ms
I've already tried commenting selection handling and eventContent functions but didn't notice any significant difference.
fullcalendar initialization
this.calendarOptions = {
headerToolbar: {
left: '',
right : 'prev title next'
},
customButtons:
{
prev:{
click:this.previousMonth.bind(this)
},
next:{
click:this.nextMonth.bind(this)
},
},
showNonCurrentDates: false,
fixedWeekCount: false,
views: {
dayGridMonth: { // name of view
titleFormat: {month:"2-digit"}
}
},
dayCellContent: arg => {
return arg.date.getDate();
},
aspectRatio:1.2,
height: 'auto',
unselectAuto: false,
eventColor:"white",
locale:jaLocale,
rerenderDelay:1,
initialDate: 2021-09-17,
events:this.Price,
eventContent:this.renderEvent,
select: this.handleDateSelect.bind(this),
dateClick: clickInfo => {
const calendarApi = clickInfo.view.calendar;
calendarApi.select(clickInfo.date);
},
eventClick: clickInfo => {
const calendarApi = clickInfo.view.calendar;
calendarApi.select(clickInfo.event.start);
},
datesSet: this.handleDatesSet.bind(this),
unselect: this.handleDateUnselect.bind(this)
};

How to take photo continuously using XLabs

Currently I'm developing a cross-platform app using Shared Library that able to take photos. I'm using XLabs.Forms V2.0.5782 package to do this app. I successfully developed this simple app but it only allows me to take one picture at a time.
I messed around with the codes and I managed to take multiple pictures but the problem is, the camera will be closed when I clicked 'Use Photo' and reopen again to take the next photo. What I wanted is, when I clicked 'Use Photo', the camera will reopen on the spot instead of closing and reopen.
Here's the code I did to take multiple pictures but I know it is not the right way to do it. It is in button clicked event.
IDevice device = Resolver.Resolve<IDevice>();
IMediaPicker media = device.MediaPicker;
//More codes here
async void TakePicture(object sender, System.EventArgs e)
{
var options = new CameraMediaStorageOptions()
{
PercentQuality = 50,
DefaultCamera = CameraDevice.Rear,
MaxPixelDimension = 250
};
var cancel = false;
while (!cancel)
{
await media.TakePhotoAsync(options).ContinueWith(t =>
{
if (t.IsFaulted) //If there's an error when taking photos
{
DisplayAlert("Error", "An error occurred when taking photo.\nPlease try again.", "OK");
}
else if (t.IsCanceled) //When the user click 'Cancel'
{
cancel = true;
}
else //When the user click 'Use Photo' - Here's the part where the camera will close and reopen until user click 'Cancel'
{
var img = ImageSource.FromStream(() => t.Result.Source);
picList.Add(img);
}
});
}
if (picList.Count > 0)
{
scrollParent.IsVisible = true;
imageScroll.Children.Clear();
foreach (var pl in picList)
{
var image = new Image()
{
Source = pl,
HeightRequest = 150,
HorizontalOptions = LayoutOptions.Start,
Aspect = Aspect.AspectFit,
Margin = new Thickness()
{
Right = 10
}
};
imageScroll.Children.Add(image);
}
}
}
Is it possible for me to take multiple pictures with XLabs.Forms and is there a proper way? I've search everywhere but found nothing about this. Any help will be much appreciated. Thanks!
Note:
I'm using Visual Studio for Mac Version Preview 9 (7.0 build 2943)
I've only tested on iPhone running iOS 10.2. Have not tested on Android device yet
Here's a gif showing an example of my app. I think this will make you guys have a better understanding of what I want and what is happening
Please note that 3 photos are taken in this example. The camera opens up four times. After taking each photo, I clicked 'Use Photo' on the bottom right and when the camera open on the 4th time, I clicked 'Cancel' on the bottom left to stop the loop
Thank you!

Air for IOS Webview - apple app review says every tab and/or button launches mobile Safari.?

I pulling my hair out trying to figure out where I have gone wrong.
I created a very simple app for ios that uses webView to load certain webpages within app. from my knowledge and every ios air webView reference I have found online I have coded everything correctly. Runs beautifully on android.
apple app review says every tab and/or button launches mobile Safari.?
I don't see how this is possible because they even said my button that only has gotoAndPlay(2); apparently that navigates to Safari also. ?
here's the code I used for webView:
QMBTN.addEventListener(MouseEvent.CLICK, QMB);
function QMB(event:MouseEvent):void
{
webView.viewPort = new Rectangle( 0, 135, stage.stageWidth, 600 );
webView.stage = this.stage;
webView.loadURL( "http://mywebpageeurl.com.au" );
whiteBOX.gotoAndStop(2);
}
and this is the code for my internal frame nav.
Menu_BTN2.addEventListener(MouseEvent.CLICK, GoMenuSRC);
function GoMenuSRC(event:MouseEvent):void
{
webView.stage = null;
whiteBOX.gotoAndStop(1);
}
Am I missing something or ????
The only other thing I could think could be the culprit might be my error handler to handle errors when I click tel: or mailto: links on my webpages.
The code for the tel: / mailto: error handling.
// Error handle
var openLinksInDefaultBrowser = false;
//Check tel: func
function cdCTfunc():void
{
var NEWtelLNK = webView.location.substr(0,4);
if (NEWtelLNK=='tel:')
{
openLinksInDefaultBrowser = true;
}else{openLinksInDefaultBrowser = false;}
}
webView.addEventListener(LocationChangeEvent.LOCATION_CHANGING, function (ev:LocationChangeEvent):void
{
cdCTfunc();
if(openLinksInDefaultBrowser == false)
{
ev.preventDefault();
webView.loadURL(ev.location); //'ev.url' changed to 'ev.location'started with prerelease build - [07/20/10]
}
if (openLinksInDefaultBrowser == true)
{
trace('page loaded in default browser');
var phStr:String=ev.location;
var callPH:URLRequest= new URLRequest(phStr);
navigateToURL(callPH);
}
});
webView.addEventListener(LocationChangeEvent.LOCATION_CHANGE, function (ev:LocationChangeEvent):void
{
if (webView.location.indexOf('authentication_complete') != -1)
{
trace('auth token is: ' + webView.location.substr(webView.location.indexOf('token=') + 6));
}
trace('the new location is: ' + webView.location);
trace(webView.location.substr(0,4));
});
webView.addEventListener('complete', function(ev:Event):void
{
trace('complete event');
});
webView.addEventListener('error', function(ev:ErrorEvent):void
{
var phStr:String=webView.location;
var callPH:URLRequest= new URLRequest(phStr);
navigateToURL(callPH);
webView.isHistoryBackEnabled;
webView.historyBack();
trace('SOME Bloody Error Loading The Page: ' + ev.text);
trace(openLinksInDefaultBrowser);
});
but I still don't see how this could cause a gotoAndStop(); to launch safari.
I am absolutely stumped.
Please Help?
Thank you in advance.
Before submitting your app for review you should run it through Testflight.
This allows you to test an 'AppStore' build of your binary so you will see exactly what the reviewer will see.
http://www.yeahbutisitflash.com/?p=7608

Share via Facebook and Twitter Titanium SDK

I use this module on my project.
I have three Ti.Ui.Switch on a screen. If I checked them all and press button, I should share (same text and image) via Facebook and Twitter. The most important thing, user should have possibility to post this text and image without confirmation popup.
If I try Social.twitter(for example), after click on button, user must confirm post again... How can i circumvent this feature?
How i can do this?
sharePhotoButton.addEventListener('click', function(e){
fbShare();
twShare();
emailShare();
});
function fbShare(){
if(fbSwitch.value){
if(Social.isFacebookSupported()){
Social.facebook({
text: commentArea.value,
image: event.media
});
}
}
};
function twShare(){
if(twSwitch.value){
if(Social.isTwitterSupported()){
Social.twitter({
text: commentArea.value,
image: event.media
});
}
}
};
function emailShare(){
if(emailSwitch.value){
var emailDialog = Ti.UI.createEmailDialog();
if(emailDialog.isSupported()){
emailDialog.messageBody = commentArea.value;
emailDialog.open();
}
}
};

Resources