Titanium iOS - agcalendar monthview won't update view - iphone

After a new event is added... or an event is deleted I have to hit the next month button then go back to the current month for it to update the calendar properly. I got around this by using the calendarView.selectTodaysDate();. This seems to work for the most part on added events, however it doesn't work when an event is deleted
this is the module I'm using for the monthView:
Module Link
I'm thinking at this point maybe I could make the view refresh, but am not 100% sure how Titanium does that.
Any help would be sincerely appreciated!

Related

Swift 3: UIButton re-enables after midnight

I have a button which disables after it is pressed. I need To work out how to get the button re-enable after midnight, or the next day.
So I think I need the button to set the date in a variable after it is pressed. Then an if statement which enables the button if the variable does not match today's date.
Would that be the best way to handle it? Can anyone offer any rough code advice, or possibly advice of an easier way to handle enabling a button after midnight?
Thanks
Then an if statement which enables the button if the variable does not match today's date.
But the question is, an if statement where? Your code can only run if something makes it run. If your app is just sitting there, midnight can come and go and your button won't be enabled because the code that looks to see if it's a different day from the day you saved is not running.
The solution:
Register to be notified by the system when the day changes.
Woow finally some nice question... it's definitely possible... you can check this beautiful documentation by apple:
https://developer.apple.com/library/content/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html
Basically you have 2 or more solutions, just 2 comes to my mind right now:
1.) Use UserDefaults or CoreData (Userdefaults for one property is more acceptable I guess
2.) Run backgroundTask as mentioned above..
The first one is very basic solution... you get the date when the button was tapped and if the day is equal to the day you entered the screen later, you keep the button disabled, else you unlock the button and store again the date into the user defaults, this seems to me a little piggy if you ask me..
The second one is much more elegant, in a nutshell... You setup button with some actions and the last thing is disabling it. Then, you setup background Task that every next day the button becomes enabled again...
I am pretty sure you will find the codes somewhere else here, maybe you will find the first algorithm more useful for you..
Anyway wish you best luck and happy coding! :)

One click, event called twice

I have developed a mobile application. Most of the functions are inside, but I have some very strange behaviour inside the app on iOs (not tested on android yet).
When I click on an item: the event after the click is called twice. This isn't happening the whole time, but happens now and then. This is a problem for when I try to go to the next slide (he things he should move twice to a next slide), but also when I try to open the gallery for selecting photos, he opens the gallery twice, login for facebook happens twice etc... The strange thing is, that this isn't the whole time the case.
I have normal buttons like
<button ion-button color="black" class="skip-button"
(click)="nextStep()" [hidden]="lastSlide">Next</button>
so I don't think that the coding is wrong (or is it wrong).
I use this version:
ionic --version
2.1.18
In the beginning of the development I hadn't this issue. I think that I was using an older version of ionic2 then. Is there a way to go back perhaps?
I was in the meantime working on another project without having this issue (in that project). My last try was to copy the other project and copy pages and providers from the project with the error. The error is now gone, but still no clue why there was such an error.

Property additionalActions of NSUserNotification seems not working?

To understand NSUserNotification better, I wrote a little test app playing with this class.
So far so good, except that no matter how hard I tried to feed the additionalActions property with array of NSUserNotificationAction objects, it never showed any difference but only one action button and a close one.
My expectation for this property is that the notification would show a pull-down menu containing the additional buttons I offer as it does in the Mac App Store update notifications.
Am I missing something? Or are you having the same problem, since it is a bug awaiting Apple to tackle?
Can you please try to click and hold down the action button in your notification? Does it show a drop-down menu of additionalActions?
Update
As it turns out, you can show the little chevron next to the action button by setting a true value for the private _alwaysShowAlternateActionMenu key on the notification. In Swift 3, it would look like this:
notification.setValue(true, forKey: "_alwaysShowAlternateActionMenu")
However, as I mentioned this is a private API and I strongly advise against using it if you want to distribute your App through the Mac App Store.
It is probably a bug. Setting up additionalActions will create the list, but not the little arrow icon. Holding down on actionButton will show the menu with the number of actions you set.
Besides setting additionalActions will cause several other problems. I will save this for another question.
Refer to another question.
show NSUserNotification additionalActions on click
P.S. I am using El Capitan APIs

How to remove state from bootstrap tour

I'm using bootstrap tour, and everything is working fine.
What i'd like to do now, is create a "dismiss for now" button, that should display the tour next time the page is loaded.
In the local storage, when the tour ends, it creates a key called "tour_end" and the value is "yes", so, what i'm trying to do, is to call this:
tour.removeState("tour_end")
so that hopefully, next time the page is loaded, the key is missing and the tour will show up.
Unfortunately, the previous doesn't work, and it returns with this error:
_this.tour.removeState is not a function
any suggestion why this is not working? or the best way to achieve the "dismiss for now" behave?
Thanks a lot
Edit -
I solved this adding localStorage.removeItem("tour_end"); and it seams to work as expected.

ReactiveUI - Confused about Routing

I'm in the process of comparing MvvmCross with ReactiveUI for a major pharma project on Win Store, WP8, iOS, Droid. We've already selected Xamarin.
I'm totally new to ReactiveUI. I really like what I see in principle, and I think Paul is a genius. However the details are becoming a real bear. I've spend several days tracking down documentation (the manual is from 2011 and seems almost entirely outdated - it doesn't even contain the word "Router") and sample code.
I'm looking at the sample from ReactiveUI.Samples
Also the project MobileSample-RT from the ReactiveUI solution.
I based my little hello world on the ReactiveUI.Samples "Routing" example. Frankly this isn't much of an example as all it does is navigate from AppBootstrapper to the one and only view. I'm trying to do something similar to the "three page" example from MobileSample-RT. The problem is, if I try something like this in my project:
HostScreen.Router.Navigate.Execute(RxApp.DependencyResolver.GetService(typeof(LoginViewModel)));
It crashes (pdb symbols not loaded in ReactiveUI.dll)
If I try this:
HostScreen.Router.NavigateCommandFor<LoginViewModel>().Execute(HostScreen);
Same result - hard crash. That really threw me as it seems like something that should "just work".
I can call this:
HostScreen.Router.Navigate.Execute(new LoginViewModel(HostScreen));
And it does go to my view, as expected. I also wired up a back button in the main screen:
this.OneWayBind(AppBootstrapper, x => x.Router.NavigateBack, x => x.BackButton.Command);
And that indeed moves back from the view to which I'd just navigated.
So now I want to move forward again. I click on the button that does this (again):
HostScreen.Router.Navigate.Execute(new LoginViewModel(HostScreen));
And I go back to that view. However this time it takes 2 clicks on the back button to get actually move back. If I then move forward again, it takes 3 clicks the next time. The NavigationStack is filling up with new instances of LoginViewModel.
So, what IS the correct way to do routing/navigation? Why are those commands crashing? Rather than calling "new" each time in the Navigate.Execute, how do I navigate to a viewmodel that is already in the navigation stack (or should it be there in the first place?).
Many thanks for any clarity you can provide.
If you're building for iOS and Android, you simply don't want to use Routing - the notion of routing conflicts too much with what the platforms want you to do (even on WP8 it's a stretch but I was able to hacky make it work). You should stick with View-first location.
However, if you're using Xamarin Forms, ReactiveUI works great with VM-based routing (since Xamarin managed to do all the hacks to make it possible!). Check out https://github.com/paulcbetts/xamarinevolve2014 for a demo of it
I know the docs suck and I'm working on new ones:
https://github.com/reactiveui/ReactiveUI/pull/391 - Pull Request / Progress
https://github.com/reactiveui/ReactiveUI/tree/docs/docs/basics - Browsable version