From ff495ff1dbf46c8d0b5e09aa183f9205b583260f Mon Sep 17 00:00:00 2001 From: Peter Siegmund Date: Fri, 1 Apr 2016 10:48:17 +0200 Subject: [PATCH 1/2] Race Manager must be able to manage non-public events --- .../sailing/server/gateway/jaxrs/api/EventsResource.java | 6 +++--- mobile/com.sap.sailing.racecommittee.app/assets/build.info | 2 +- .../res/values-de/strings.xml | 5 ++++- .../res/values/preferences.xml | 3 +++ .../res/values/strings.xml | 4 +++- .../res/xml/preference_general.xml | 6 ++++++ .../com/sap/sailing/racecommittee/app/AppPreferences.java | 5 +++++ .../sailing/racecommittee/app/data/OnlineDataManager.java | 5 +++-- 8 files changed, 28 insertions(+), 8 deletions(-) diff --git a/java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/jaxrs/api/EventsResource.java b/java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/jaxrs/api/EventsResource.java index c80d0badd8d..9fba7e3571c 100644 --- a/java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/jaxrs/api/EventsResource.java +++ b/java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/jaxrs/api/EventsResource.java @@ -35,13 +35,13 @@ public class EventsResource extends AbstractSailingServerResource { @GET @Produces("application/json;charset=UTF-8") - public Response getEvents() { - // TODO bug2589, bug3504: the following will require EVENT:READ permission; it requires cross-server links to be authentication aware... + public Response getEvents(@QueryParam("showNonPublic") String showNonPublic) { + // TODO bug2589, bug3504: the following will require EVENT:READ permission; it requires cross-server links to be authentication aware... // SecurityUtils.getSubject().checkPermission(Permission.EVENT.getStringPermission(Permission.Mode.READ)); JsonSerializer eventSerializer = new EventBaseJsonSerializer(new VenueJsonSerializer(new CourseAreaJsonSerializer()), new LeaderboardGroupBaseJsonSerializer()); JSONArray result = new JSONArray(); for (EventBase event : getService().getAllEvents()) { - if (event.isPublic()) { + if ((showNonPublic != null && Boolean.valueOf(showNonPublic)) || event.isPublic()) { result.add(eventSerializer.serialize(event)); } } diff --git a/mobile/com.sap.sailing.racecommittee.app/assets/build.info b/mobile/com.sap.sailing.racecommittee.app/assets/build.info index 13f81c9bd79..76742ecad44 100644 --- a/mobile/com.sap.sailing.racecommittee.app/assets/build.info +++ b/mobile/com.sap.sailing.racecommittee.app/assets/build.info @@ -1 +1 @@ -${git.branch}-${git.commit.id.abbrev} (${git.commit.time}) +ubilabs--rcapp--bug-3450-8c0c286 (Fri Apr 01 10:45:04 CEST 2016) diff --git a/mobile/com.sap.sailing.racecommittee.app/res/values-de/strings.xml b/mobile/com.sap.sailing.racecommittee.app/res/values-de/strings.xml index 11475c2c3df..36c9055b21b 100644 --- a/mobile/com.sap.sailing.racecommittee.app/res/values-de/strings.xml +++ b/mobile/com.sap.sailing.racecommittee.app/res/values-de/strings.xml @@ -482,4 +482,7 @@ Missweisend Kursanzeige - \ No newline at end of file + Zeige nicht öffentliche Events + Lade alle Events, auch die nicht öffentlichen. + + diff --git a/mobile/com.sap.sailing.racecommittee.app/res/values/preferences.xml b/mobile/com.sap.sailing.racecommittee.app/res/values/preferences.xml index 298da4716b6..9ea02046b1e 100644 --- a/mobile/com.sap.sailing.racecommittee.app/res/values/preferences.xml +++ b/mobile/com.sap.sailing.racecommittee.app/res/values/preferences.xml @@ -108,4 +108,7 @@ Dark Light + + show_non_public_events + false diff --git a/mobile/com.sap.sailing.racecommittee.app/res/values/strings.xml b/mobile/com.sap.sailing.racecommittee.app/res/values/strings.xml index c13f9cca623..006c1d87009 100644 --- a/mobile/com.sap.sailing.racecommittee.app/res/values/strings.xml +++ b/mobile/com.sap.sailing.racecommittee.app/res/values/strings.xml @@ -509,4 +509,6 @@ North-based Heading - \ No newline at end of file + Show Non Public Events + Load all events including the no public one. + diff --git a/mobile/com.sap.sailing.racecommittee.app/res/xml/preference_general.xml b/mobile/com.sap.sailing.racecommittee.app/res/xml/preference_general.xml index 0d1f96bf120..8ce2d002d79 100644 --- a/mobile/com.sap.sailing.racecommittee.app/res/xml/preference_general.xml +++ b/mobile/com.sap.sailing.racecommittee.app/res/xml/preference_general.xml @@ -60,6 +60,12 @@ android:key="@string/preference_mail_key" android:title="@string/settings_advanced_mail_header"/> + + > handler = new EventsDataHandler(OnlineDataManager.this); // ExLog.i(context, TAG, "getEventsLoader created new loader..."); - - URL url = UrlHelper.generateUrl(preferences.getServerBaseURL(), "/sailingserver/api/v1/events", null); + List> params = new ArrayList<>(); + params.add(new Util.Pair("showNonPublic", AppPreferences.on(context).showNonPublic())); + URL url = UrlHelper.generateUrl(preferences.getServerBaseURL(), "/sailingserver/api/v1/events", params); return new OnlineDataLoader>(context, url, parser, handler); } From 85b4486869a5920501520cd6b9804c6fc86d723f Mon Sep 17 00:00:00 2001 From: Konstantin Gonikman Date: Fri, 1 Apr 2016 13:30:08 +0200 Subject: [PATCH 2/2] Fix for 3557 (Welcome Popup shows twice after using check in link) --- .../SAPTracker.xcodeproj/project.pbxproj | 5 -- .../src/xcode/SAPTracker/AppDelegate.swift | 8 +-- .../SAPTracker/Base.lproj/Main.storyboard | 55 ++++++++----------- .../xcode/SAPTracker/HomeViewController.swift | 47 ++++++++++++++++ .../xcode/SAPTracker/LaunchScreen.storyboard | 9 ++- .../xcode/SAPTracker/SplashScreenDummy.swift | 24 -------- 6 files changed, 74 insertions(+), 74 deletions(-) delete mode 100644 ios/SAPTracker/src/xcode/SAPTracker/SplashScreenDummy.swift diff --git a/ios/SAPTracker/src/xcode/SAPTracker.xcodeproj/project.pbxproj b/ios/SAPTracker/src/xcode/SAPTracker.xcodeproj/project.pbxproj index 10ad8cd21a7..2832567d902 100644 --- a/ios/SAPTracker/src/xcode/SAPTracker.xcodeproj/project.pbxproj +++ b/ios/SAPTracker/src/xcode/SAPTracker.xcodeproj/project.pbxproj @@ -283,7 +283,6 @@ 7F44095B19F65B5B0021BF22 /* CoreData.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 7F44095919F65B5B0021BF22 /* CoreData.xcdatamodeld */; }; 7F4D2F541A1C8EE50038E7D1 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7F4D2F531A1C8EE50038E7D1 /* Images.xcassets */; }; 7F4EEDBA1A6D2BAC0026F711 /* CheckIn.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F4EEDB91A6D2BAC0026F711 /* CheckIn.swift */; }; - 7F72C73A1A2DC51900F48EE8 /* SplashScreenDummy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F72C7391A2DC51900F48EE8 /* SplashScreenDummy.swift */; }; 7F83F15619F154F000C53328 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F83F15519F154F000C53328 /* AppDelegate.swift */; }; 7F83F15819F154F000C53328 /* HomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F83F15719F154F000C53328 /* HomeViewController.swift */; }; 7F83F15B19F154F000C53328 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7F83F15919F154F000C53328 /* Main.storyboard */; }; @@ -648,7 +647,6 @@ 7F44095A19F65B5B0021BF22 /* CoreData.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = CoreData.xcdatamodel; sourceTree = ""; }; 7F4D2F531A1C8EE50038E7D1 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 7F4EEDB91A6D2BAC0026F711 /* CheckIn.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CheckIn.swift; sourceTree = ""; }; - 7F72C7391A2DC51900F48EE8 /* SplashScreenDummy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SplashScreenDummy.swift; sourceTree = ""; }; 7F83F15019F154F000C53328 /* SAPTracker.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SAPTracker.app; sourceTree = BUILT_PRODUCTS_DIR; }; 7F83F15419F154F000C53328 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 7F83F15519F154F000C53328 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -1080,7 +1078,6 @@ 7FD9D3021A1236080058FEAD /* Extensions.swift */, 7F87CAA51A2CD6BA0076C617 /* Appearance.h */, 7F87CAA61A2CD6BA0076C617 /* Appearance.m */, - 7F72C7391A2DC51900F48EE8 /* SplashScreenDummy.swift */, 9E95C3D51C723AB30016632B /* Constants.swift */, ); name = Helpers; @@ -1222,7 +1219,6 @@ TargetAttributes = { 7F83F14F19F154F000C53328 = { CreatedOnToolsVersion = 6.0.1; - DevelopmentTeam = RRE8EFVCE3; }; 7F83F16419F154F000C53328 = { CreatedOnToolsVersion = 6.0.1; @@ -1621,7 +1617,6 @@ 7F06590419F8094C0077FF95 /* DeviceUDIDManager.swift in Sources */, 7F3AA7C81A1CD7D700F8861F /* SendGPSFixController.swift in Sources */, 7FCDB6641A1636610075D7D9 /* LeaderBoard.swift in Sources */, - 7F72C73A1A2DC51900F48EE8 /* SplashScreenDummy.swift in Sources */, C8603D4A1C528832002B2F28 /* Acknowledgements.markdown in Sources */, 7F8B8D411A373B0200C34B88 /* SpeedViewController.swift in Sources */, 9E95C3D61C723AB30016632B /* Constants.swift in Sources */, diff --git a/ios/SAPTracker/src/xcode/SAPTracker/AppDelegate.swift b/ios/SAPTracker/src/xcode/SAPTracker/AppDelegate.swift index 63ee2b99f82..28a557af945 100644 --- a/ios/SAPTracker/src/xcode/SAPTracker/AppDelegate.swift +++ b/ios/SAPTracker/src/xcode/SAPTracker/AppDelegate.swift @@ -44,13 +44,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { } func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool { - - if window!.rootViewController is SplashScreenDummy { - let storyboard = UIStoryboard(name: "Main", bundle: nil) - let vc = storyboard.instantiateViewControllerWithIdentifier("rootViewController") - self.window!.rootViewController = vc - } - + let rootViewController = self.window!.rootViewController as! UINavigationController rootViewController.popToRootViewControllerAnimated(false) rootViewController.dismissViewControllerAnimated(false, completion: nil) diff --git a/ios/SAPTracker/src/xcode/SAPTracker/Base.lproj/Main.storyboard b/ios/SAPTracker/src/xcode/SAPTracker/Base.lproj/Main.storyboard index ef4434c06a0..bc5e07836d7 100644 --- a/ios/SAPTracker/src/xcode/SAPTracker/Base.lproj/Main.storyboard +++ b/ios/SAPTracker/src/xcode/SAPTracker/Base.lproj/Main.storyboard @@ -1,5 +1,5 @@ - + @@ -210,6 +210,7 @@ + @@ -217,6 +218,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -1457,38 +1478,6 @@ Cg - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ios/SAPTracker/src/xcode/SAPTracker/HomeViewController.swift b/ios/SAPTracker/src/xcode/SAPTracker/HomeViewController.swift index f6644428691..16faace6a95 100755 --- a/ios/SAPTracker/src/xcode/SAPTracker/HomeViewController.swift +++ b/ios/SAPTracker/src/xcode/SAPTracker/HomeViewController.swift @@ -25,12 +25,15 @@ class HomeViewController: UIViewController, UITableViewDataSource, UITableViewDe @IBOutlet weak var tableView: UITableView! @IBOutlet weak var tableViewHeight: NSLayoutConstraint! @IBOutlet weak var activityIndicatorView: UIActivityIndicatorView! + @IBOutlet var vSplashScreen: UIView! var fetchedResultsController: NSFetchedResultsController? private var qrCodeManager: QRCodeManager? override func viewDidLoad() { super.viewDidLoad() + + loadSplashScreen() // set QR manager, needed in case app is being open by custom URL qrCodeManager = QRCodeManager(delegate: self) @@ -61,6 +64,50 @@ class HomeViewController: UIViewController, UITableViewDataSource, UITableViewDe let barButtonItem = UIBarButtonItem(customView: imageView) navigationItem.leftBarButtonItem = barButtonItem } + + func loadSplashScreen() { + + if let keyWindow = UIApplication.sharedApplication().keyWindow { + + vSplashScreen.translatesAutoresizingMaskIntoConstraints = false + keyWindow.addSubview(vSplashScreen) + + let lcTop = NSLayoutConstraint(item: vSplashScreen, + attribute: NSLayoutAttribute.Top, + relatedBy: NSLayoutRelation.Equal, + toItem: keyWindow, + attribute: NSLayoutAttribute.Top, + multiplier: 1.0, + constant: 0) + let lcBottom = NSLayoutConstraint(item: vSplashScreen, + attribute: NSLayoutAttribute.Bottom, + relatedBy: NSLayoutRelation.Equal, + toItem: keyWindow, + attribute: NSLayoutAttribute.Bottom, + multiplier: 1.0, + constant: 0) + let lcLeft = NSLayoutConstraint(item: vSplashScreen, + attribute: NSLayoutAttribute.Left, + relatedBy: NSLayoutRelation.Equal, + toItem: keyWindow, + attribute: NSLayoutAttribute.Left, + multiplier: 1.0, + constant: 0) + let lcRight = NSLayoutConstraint(item: vSplashScreen, + attribute: NSLayoutAttribute.Right, + relatedBy: NSLayoutRelation.Equal, + toItem: keyWindow, + attribute: NSLayoutAttribute.Right, + multiplier: 1.0, + constant: 0) + keyWindow.addConstraints([lcTop, lcBottom, lcLeft, lcRight]) + + weak var weakself = self + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(2 * Double(NSEC_PER_SEC))), dispatch_get_main_queue()) { () -> Void in + weakself?.vSplashScreen.removeFromSuperview() + } + } + } deinit { NSNotificationCenter.defaultCenter().removeObserver(self) diff --git a/ios/SAPTracker/src/xcode/SAPTracker/LaunchScreen.storyboard b/ios/SAPTracker/src/xcode/SAPTracker/LaunchScreen.storyboard index d3b5e3e1be4..cbfb2d68981 100644 --- a/ios/SAPTracker/src/xcode/SAPTracker/LaunchScreen.storyboard +++ b/ios/SAPTracker/src/xcode/SAPTracker/LaunchScreen.storyboard @@ -1,10 +1,9 @@ - + - + - @@ -29,8 +28,8 @@ - - + + diff --git a/ios/SAPTracker/src/xcode/SAPTracker/SplashScreenDummy.swift b/ios/SAPTracker/src/xcode/SAPTracker/SplashScreenDummy.swift deleted file mode 100644 index ca4aa01a0a2..00000000000 --- a/ios/SAPTracker/src/xcode/SAPTracker/SplashScreenDummy.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// SplashScreenDummy.swift -// SAPTracker -// -// Created by computing on 02/12/14. -// Copyright (c) 2014 com.sap.sailing. All rights reserved. -// - -import Foundation - -final class SplashScreenDummy: UIViewController { - - override func viewDidAppear(animated: Bool) { - super.viewDidAppear(animated) - - weak var weakself = self - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(2 * Double(NSEC_PER_SEC))), dispatch_get_main_queue()) { () -> Void in - let storyboard = UIStoryboard(name: "Main", bundle: nil) - let vc = storyboard.instantiateViewControllerWithIdentifier("rootViewController") - vc.modalTransitionStyle = .CrossDissolve - weakself?.presentViewController(vc, animated: true, completion: nil) - } - } -} \ No newline at end of file