How to remove all entries (delete data) from root / in Firebase? - swift

I'm trying to reset the database programatically from Swift. I want to achieve the same result as in the Firebase console, clicking the red X on the name of the database (root path)

The Firebase API reference for Objective-C has two methods that seem to be relevant:
Firebase.removeValue
Firebase.removeValueWithCompletionBlock:block
The latter allows you to supply a callback to call after the removal has been completed.

Related

MongoDB Realm: environment value exists but is undefined inside Realm Function

I am referencing an environment value from a Realm function as instructed here: context.values.get("appTwilioNumber")
I confirmed appTwilioNumber exists in our project: and that our project is assigned an environment:
Yet, when I call console.log('twilioNumberForEnv:', context.values.get("appTwilioNumber")); in our Realm function, I get twilioNumberForEnv: undefined.
EDIT 1: I have more info now--I logged out and logged back in (in case of multi-user sync issues), then exported my app from the Realm UI and the values folder is empty. Not sure if that is a separate bug, but updating in case this info is useful.
EDIT 2: the environment values are stored under environment, not under values. Edit 1 was a red herring. I do see appTwilioNumber in the exported app, but it still returns undefined in the Realm functions.
Wow... Mongo's documentation might be off.
In another function, I found this: context.environment.values.anotherEnvValue instead of context.values.get("appTwilioNumber") . So I updated my code to context.environment.values.appTwilioNumber, and it worked.
I did a CMD-f on both https://docs.mongodb.com/realm/values-and-secrets/define-environment-values/ and https://docs.mongodb.com/realm/values-and-secrets/access-a-value/ for ".environment", and it isn't on either page.
I'll follow up with Mongo, but please use context.environment.values.YOURENVVALUE instead of context.values.get("YOURENVVALUE") if you encounter this issue.

Trying to add notifications to a crud operation in list view

I'm trying to add some notifications to the delete operation on one of my cruds, basically to inform the admin that while successful, the model has some lingering relationships that they may want to remove/deal with.
I've tried adding \Alert::add('warning', 'The text of the notification')->flash(); into the delete operation (and this does show up if the page is then refreshed) but isn't shown in the same way the "Item deleted successfully" one is.
The only option I can see is to not use $this->crud->delete($id); and build out all the functionality there on my own.
I also had a similar situation to you. What I did is, First I have written my condition in destroy function I have created if and in else conditions in if my conditional logic and in else "$this->crud->delete($id)". In my code, if the condition is not met then I have simply return a boolean('true|false') in the form of a string and catch that as result in "resources/views/vendor/backpack/crud/buttons/delete.blade.php" and make your custom notification in if condition.

Stable ID's in fiori launchpad

I am using a FlexColumnLayout for my app.
In the mid column I need to access a controll of the begin column of the FlexColumnLayout. Here is the problem:
Since it is a different view I cannot use
this.getView().byId("myId")
My first solution was to use stable ID's, by giving the views (XML) IDs.
Like that I could use:
sap.ui.getCore().byId("application---viewId--myId")
At first it worked just fine, but now that I integrated my app into the fiori launchpad the first part of the stable ID (the part before "viewId") changed and when I transport into productive it will change again.
Is there a way to access the mid column controls without sap.ui.getCore().byId?
Or is there a way to load the first part dynamically so I don't need to change my IDs when tranporting?
Sadly I don't know how to reproduce a Launchpad for testing purposes, but for those who want to test their ideas about my problem, my FlexColumnLayout is build just like in the DemoApp: https://sapui5.hana.ondemand.com/#/entity/sap.f.FlexibleColumnLayout
Ok guys i found a solution:
this.getView().getParent().getParent()
returns the FlexColumnLayout. This has a method called "getBeginColumnPages", which returns an array of the views representing the begin column. Now that i can access the view in which my control is found, i can access it with the sap.ui.core.mvc.View.byId() method.
Now I have
this.getView().getParent().getParent().getMidColumnPages()[0].byId("myId")
Since the doulbe .getParent() doesn't seem to be ideal, please post a better solution if you know one : D
You have to use createId() function, this will return the complete ID of your control.
this.byId(this.createId("myid"));

How to use ApplyAction

I've been trying to search for information on how use the copyCard trello action, it looks like I should use Card.ApplyAction, but I am not sure if thats the correct way. I have not found how to set the needed data on the action to copy the card.
Is there a method in Manatee.Trello to copy a card or do I just do it all myself? If there is how do you use it?
To copy a card, you'll need the destination list. If you're just trying to put it in the same list, that's card.List.
Then you can just add a new card using the existing card as a source:
var card = new Card("<card ID>");
var copy = Card.List.Cards.Add(card);
Done!
Edit for completeness
The ActionTypes enum serves two purposes:
Identify the type of action when you get the list of actions (card.Actions) for objects that expose them (boards, lists, cards, etc.)
Filter actions that are included in the Filter() extension method.
You can find out more on the Manatee.Trello wiki
Another edit for more completeness
The card.ApplyAction() method is for web hooks. When a request is received, the content is deserialized as a string and passed to this method. It is an alternative updating mechanism from the default on-demand polling.

SyncAdapter without ContentObserver

I recently learned that when using a ContentProvider with CursorLoaders, there is no need to create your own ContentObserver, you just call cursor#setNotificationUri() or getContext().getResolver().notifyChange. Now i want to use a SyncAdapter to perform syncs on data change, and a requirement for this is having a ContentObserver for the respective URIs, my question is, what effect will this have on the aforementioned way of listening for data changes?
You don't need a ContentObserver to trigger a sync when using a SyncAdapter. Just make sure you set syncToNetwork to true when you call notifyChange (Uri uri, ContentObserver observer, boolean syncToNetwork).
Android will automatically call all SyncAdapters for this authority that have supportsUploading set to true and that are configured to sync automatically.