I had a serious accident, my fork suddenly snapped when riding. I sent my bike for repair (to get a new fork installed) and the guys at the shop hammered the frame in place, as apparently the frame bent from the crash. Now after the very scary crash I had, I am wondering if I should even ride the bike in that condition? I know it is impossible to predict how much time will it take for it to fail, but other than checking very often if the area next to the bumps changes, what else can I do? I know that getting new pieces welded is not an option as it is hard to weld aluminum and it is probably less expensive or equally expensive just to get a new frame.
If an aluminium frame has to be bent back into alignment, it's trashed. Aluminium cannot be deformed without causing weakness in the material.
If the bicycle repair shop literally hit the seat stays with a hammer near the dropouts to straighten the frame is probably weakened in those areas and is very likely unsafe. I personally would not ride that frame.
The bicycle repair shop should have told you the frame was un-repairable and not replaced the fork. Maybe they wanted to make some money of a repair job but I can't believe they passed up an opportunity to sell you a new bike.
For the long term, that repair should not be trusted and the point of weakened aluminum is correct. However, if this is your only transportation and you can't get anything else immediately, I would say it can be ridden until an alternative is found.
The front fork is two pieces, and if either side fails (or the center), the front wheel comes off and that normally results in an immediate, and often pretty bad crash.
If one of those weakened points on the rear wheel breaks, there is still another connection holding the wheel on (4 posts, two on each side). Depending on how it breaks, the wheel may twist, but it's probably not going to immediately fall off. In other words you will have some warning and the ability to stop (still have your front braking power).
So, again, long term - get a new bike, or argue with the shop that "repaired" it, but if its essential, I would ride that bike in the short term.
Don't take it to a bike shop, take it to a reputable frame builder particularly one who works in aluminum.
He'll have the jigs and the experience to tell you what's wrong with the frame and if it's reparable. He may be able to remove the entire rear triangle and replace it for less than it would cost to get an equivalent new frame, or he may tell you that it's simply not worth it.
I once had a huge wreck on a steel frame which misaligned the whole bike. A builder was able to adjust everything back into alignment and told me that the little wrinkle in the down tube was something to keep an eye on, but should be OK for a while. I put many thousand more miles on that frame. Of course, that was steel and this is aluminum, so your mileage may vary, but a frame builder will be able to be the best judge.
Without knowing the specific aluminum alloy and level of heat treat (if any) it's impossible to estimate what portion of the design safety margin has been compromised. Fortunately that's not important. The real question is how long to you want to ride a bike that may come apart unexpectedly? You're the only one able to make that evaluation.
Bending aluminium does not cause sudden failure. Take a piece of aluminium and try it your self. Like any metal, repeatedly bending aluminium will gradually make it weaker. (This is a common failure mechanism for very old steel bikes). Unlike steel, aluminium has no "absolute minimum" value for softness (which enables you to specify intrinsically safe steel components). For this reason, aluminium parts have to be over-specified, because they always just get gradually softer and softer in use.
Bicycle frames (especially expensive bicycle frames) are designed to be as light as possible. For this reason they are shaped into the most efficient shape possible. If you dent a tube out of shape, it will not be as strong as it would be. If you dent a tube on any bicycle, it will materially weaken the tube. This is not because it is Aluminium or Steel: it is because it is a tube. On a bicycle some tubes are critical (the front forks, the head piece), some tubes are not critical (the cross bars: you can just keep on riding with broken cross bars), but will critical in traffic or when making a sharp turn on a fast downhill. And some tubes barely matter at all (the rear wheel posts), as you know if you've ever had one fail at speed in traffic.
The pictures you've posted show damage that hardly matters at all, at a location that matters very little. The effect of softening is marginal (bicycle alloys are selected for handling 1000's of repeated stress cycles), and it's a location where the change in shape is less than critical. The bike shop (which doubtless see lots of damaged bikes discarded), didn't even think it was worth trying to sell you a new bike.
If you ride a frame long enough and hard enough, it will fail. This frame may fail at the rear wheel, or, the way you're riding it, you may do the front forks again first.