Skip to content

Commit

Permalink
few more cleanup beginning of tooltips #92 and fixes for notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
roznet committed Apr 10, 2021
1 parent 26f53c2 commit 7091b1f
Show file tree
Hide file tree
Showing 12 changed files with 205 additions and 14 deletions.
26 changes: 25 additions & 1 deletion ConnectStats.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,12 @@
42FC98DC261C6A4D00ACF6E1 /* GCActivityTypeSelectionViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 42FC98D8261C6A4D00ACF6E1 /* GCActivityTypeSelectionViewController.xib */; };
42FC98F4261CFC0000ACF6E1 /* GCActivityTypeSelectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42FC98D7261C6A4D00ACF6E1 /* GCActivityTypeSelectionViewController.swift */; };
42FC98F5261CFC0000ACF6E1 /* GCActivityTypeSelectionViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 42FC98D8261C6A4D00ACF6E1 /* GCActivityTypeSelectionViewController.xib */; };
42FC992826218EE200ACF6E1 /* GCTooltipView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42FC992726218EE200ACF6E1 /* GCTooltipView.swift */; };
42FC992926218EE200ACF6E1 /* GCTooltipView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42FC992726218EE200ACF6E1 /* GCTooltipView.swift */; };
42FC992A26218EE200ACF6E1 /* GCTooltipView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42FC992726218EE200ACF6E1 /* GCTooltipView.swift */; };
42FC993C262193CA00ACF6E1 /* GCTooltipView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 42FC993B262193CA00ACF6E1 /* GCTooltipView.xib */; };
42FC993D262193CA00ACF6E1 /* GCTooltipView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 42FC993B262193CA00ACF6E1 /* GCTooltipView.xib */; };
42FC993E262193CA00ACF6E1 /* GCTooltipView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 42FC993B262193CA00ACF6E1 /* GCTooltipView.xib */; };
42FD55B91B90A39F0070B3B4 /* GCCellHealthDayActivity.m in Sources */ = {isa = PBXBuildFile; fileRef = 42FD55B81B90A39F0070B3B4 /* GCCellHealthDayActivity.m */; };
42FD55BA1B90A39F0070B3B4 /* GCCellHealthDayActivity.m in Sources */ = {isa = PBXBuildFile; fileRef = 42FD55B81B90A39F0070B3B4 /* GCCellHealthDayActivity.m */; };
42FFF6A7232EDAE1008714D5 /* user.json in Resources */ = {isa = PBXBuildFile; fileRef = 42FFF6A6232EDAE1008714D5 /* user.json */; };
Expand Down Expand Up @@ -2108,6 +2114,8 @@
42FC177F1E196E4B00F55302 /* GCTestActivityFitFile.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GCTestActivityFitFile.swift; sourceTree = "<group>"; };
42FC98D7261C6A4D00ACF6E1 /* GCActivityTypeSelectionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = GCActivityTypeSelectionViewController.swift; path = src/GCActivityTypeSelectionViewController.swift; sourceTree = "<group>"; };
42FC98D8261C6A4D00ACF6E1 /* GCActivityTypeSelectionViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = GCActivityTypeSelectionViewController.xib; path = src/GCActivityTypeSelectionViewController.xib; sourceTree = "<group>"; };
42FC992726218EE200ACF6E1 /* GCTooltipView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = GCTooltipView.swift; path = src/GCTooltipView.swift; sourceTree = "<group>"; };
42FC993B262193CA00ACF6E1 /* GCTooltipView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = GCTooltipView.xib; path = src/GCTooltipView.xib; sourceTree = "<group>"; };
42FD55B71B90A39F0070B3B4 /* GCCellHealthDayActivity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GCCellHealthDayActivity.h; path = src/GCCellHealthDayActivity.h; sourceTree = "<group>"; };
42FD55B81B90A39F0070B3B4 /* GCCellHealthDayActivity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GCCellHealthDayActivity.m; path = src/GCCellHealthDayActivity.m; sourceTree = "<group>"; };
42FFF6A6232EDAE1008714D5 /* user.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = user.json; path = connectstatstestapp/samples/InitialSamples/user.json; sourceTree = SOURCE_ROOT; };
Expand Down Expand Up @@ -3400,6 +3408,7 @@
428FF73D15F37440007A88FA /* UserInterface */ = {
isa = PBXGroup;
children = (
42FC991626218DAA00ACF6E1 /* ToolTips */,
424340FA1B7415C7001E22BB /* SpotLightSearch */,
42A66BCD160CFF7F00DA29A5 /* Cells */,
42A95B361632DB20000B2082 /* Maps */,
Expand Down Expand Up @@ -4225,6 +4234,15 @@
path = ConnectStatsTestAppXCTests;
sourceTree = "<group>";
};
42FC991626218DAA00ACF6E1 /* ToolTips */ = {
isa = PBXGroup;
children = (
42FC992726218EE200ACF6E1 /* GCTooltipView.swift */,
42FC993B262193CA00ACF6E1 /* GCTooltipView.xib */,
);
name = ToolTips;
sourceTree = "<group>";
};
42FD55B61B90A37A0070B3B4 /* Specialized */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -4613,6 +4631,7 @@
4211C53419AB043A000DEF87 /* version.plist in Resources */,
422CCE821B7EA81500A4DAEB /* Fields.xcassets in Resources */,
42CBD0C525E4EE880024BD28 /* TM_WORLD_BORDERS-0.2.dbf in Resources */,
42FC993E262193CA00ACF6E1 /* GCTooltipView.xib in Resources */,
422CCE851B7EA8C100A4DAEB /* Weather.xcassets in Resources */,
429184C4231B13EA00FD6525 /* Colors-iOS13.xcassets in Resources */,
42BAB8D4231C07E700639928 /* credentials.json in Resources */,
Expand Down Expand Up @@ -4677,6 +4696,7 @@
428FF71815F36888007A88FA /* InfoPlist.strings in Resources */,
42CBD0C925E4EE880024BD28 /* TM_WORLD_BORDERS-0.2.prj in Resources */,
427CF8D222ABD6BC00894253 /* credentials.json in Resources */,
42FC993C262193CA00ACF6E1 /* GCTooltipView.xib in Resources */,
42CBD0CC25E4EE880024BD28 /* TM_WORLD_BORDERS-0.2.shx in Resources */,
42CBD0C325E4EE880024BD28 /* TM_WORLD_BORDERS-0.2.dbf in Resources */,
422CCE7C1B7E9B6300A4DAEB /* Cells.xcassets in Resources */,
Expand Down Expand Up @@ -4844,6 +4864,7 @@
files = (
4295B13B2574192000728D1E /* test_activity_running_5881498219.db in Resources */,
42B5E49D1BA5BA2D000FAE4E /* strava_laps_141871826.json in Resources */,
42FC993D262193CA00ACF6E1 /* GCTooltipView.xib in Resources */,
42B5E4881BA5BA2D000FAE4E /* strava_list_5.json in Resources */,
42B5E4771BA5BA2D000FAE4E /* test_activity_running_830807000.db in Resources */,
422A24F6247325FB00D6C2FB /* activity_424479793.json in Resources */,
Expand Down Expand Up @@ -5359,6 +5380,7 @@
424208971BCC49E200F3DB12 /* GCActivityPreviewingViewController.m in Sources */,
42D4CA7F24951AF2003F3AB7 /* GCLagPeriod.m in Sources */,
42FC98DA261C6A4D00ACF6E1 /* GCActivityTypeSelectionViewController.swift in Sources */,
42FC992A26218EE200ACF6E1 /* GCTooltipView.swift in Sources */,
42BFC2331DCF4DF900EAD40E /* GCAppGlobal.swift in Sources */,
42BE67AB25A86FCE002505A2 /* GCGarminLoginSSORequest.swift in Sources */,
422FAF7119A1DD6000D09773 /* GCSettingsBugReportViewController.m in Sources */,
Expand Down Expand Up @@ -5643,6 +5665,7 @@
4209E1911DA44EC800B80735 /* GCActivitiesOrganizerListRegister.m in Sources */,
424D08C01DC5DA4E000B4620 /* GCAppPasswordManager.swift in Sources */,
4244676C184B7550009F807E /* GCActivityType.m in Sources */,
42FC992826218EE200ACF6E1 /* GCTooltipView.swift in Sources */,
426B0F101DA119060091A734 /* GCUnit+FIT.m in Sources */,
423209361868D8F600C8F305 /* GCActivity+CalculatedTracks.m in Sources */,
42FC17751E195DE300F55302 /* FITFitFieldsStatistics.swift in Sources */,
Expand Down Expand Up @@ -5781,6 +5804,7 @@
42295E081EC6F4D900F4F7EE /* GCTestServiceGarmin.m in Sources */,
4211D45D259780B900967874 /* GCStravaRequestBase.swift in Sources */,
42FC98F4261CFC0000ACF6E1 /* GCActivityTypeSelectionViewController.swift in Sources */,
42FC992926218EE200ACF6E1 /* GCTooltipView.swift in Sources */,
427DDCC01DB3D02B007745A7 /* GCGarminRequestHeartRateZones.m in Sources */,
42D4CA8524963F90003F3AB7 /* GCStatsDerivedHistoryViewController.m in Sources */,
42453BA61DD8B4E30073ACCA /* GCMapRouteLogicPointHolder.m in Sources */,
Expand Down Expand Up @@ -6948,7 +6972,7 @@
repositoryURL = "https://github.com/roznet/rzutils-touch.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.0.1;
minimumVersion = 1.0.2;
};
};
422DCC16258A630E000DEE4B /* XCRemoteSwiftPackageReference "FitFileParser" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@
"repositoryURL": "https://github.com/roznet/rzutils-touch.git",
"state": {
"branch": null,
"revision": "8dfb8e43574e8340abfddf831583cbc5985017c1",
"version": "1.0.1"
"revision": "5a396243777c14257c4e0b23c9f2229fd25252ae",
"version": "1.0.2"
}
},
{
Expand Down
7 changes: 7 additions & 0 deletions ConnectStats/src/GCActivityTypeSelectionViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@


import UIKit
import RZUtilsTouchSwift

class GCActivityTypeSelectionViewController: UIViewController {

Expand Down Expand Up @@ -58,6 +59,12 @@ class GCActivityTypeSelectionViewController: UIViewController {
}
}

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)


}


/*
// MARK: - Navigation
Expand Down
8 changes: 7 additions & 1 deletion ConnectStats/src/GCAppDelegate+Swift.m
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ -(void)registerForPushNotifications{
}

-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler{
RZLog(RZLogInfo,@"remote notification %@", userInfo);
if( userInfo[@"activity_id"] != nil){
RZLog(RZLogInfo,@"remote notification for activity %@",userInfo[@"activity_id"]);
}else{
RZLog(RZLogInfo,@"remote notification %@", userInfo);
}
application.applicationIconBadgeNumber = 1;
completionHandler(UIBackgroundFetchResultNewData);
}

Expand Down Expand Up @@ -165,6 +170,7 @@ -(void)startSuccessful{

[self settingsUpdateCheckPostStart];
[self startSuccessfulSwift];
//[UIApplication sharedApplication].applicationIconBadgeNumber = 0;
}
}

Expand Down
2 changes: 0 additions & 2 deletions ConnectStats/src/GCAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#import "GCAppActionDelegate.h"
#import "GCActivityTypes.h"

@class GCSegmentOrganizer;
@class GCConnectStatsStatus;

NS_ASSUME_NONNULL_BEGIN
Expand All @@ -53,7 +52,6 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, retain) GCHealthOrganizer * health;
@property (nonatomic, retain) GCDerivedOrganizer * derived;
@property (nonatomic, retain) GCWatchSessionManager * watch;
@property (nonatomic, retain) GCSegmentOrganizer * segments;
@property (nullable, nonatomic, retain) NSURL * urlToOpen;
@property (nonatomic, retain) GCConnectStatsStatus * remoteStatus;
// Will be either the currnet location from the phone or the location of the current activity
Expand Down
1 change: 0 additions & 1 deletion ConnectStats/src/GCAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ -(void)dealloc{
[_urlToOpen release];
[_actions release];
[_health release];
[_segments release];
[_credentials release];
[_remoteStatus release];
[_locationManager release];
Expand Down
2 changes: 0 additions & 2 deletions ConnectStats/src/GCAppGlobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ extern NSString * const kNotifyLocationRequestComplete;
@class GCAppDelegate;
@class GCActivity;
@class HKHealthStore;
@class GCSegmentOrganizer;
@class GCAppProfiles;
@class GCHealthOrganizer;
@class GCDerivedOrganizer;
Expand All @@ -60,7 +59,6 @@ extern NSString * const kNotifyLocationRequestComplete;
+(dispatch_queue_t)worker;
+(GCAppProfiles*)profile;
+(GCDerivedOrganizer*)derived;
+(GCSegmentOrganizer*)segments;

+(NSArray<NSDictionary*>*)recentRemoteMessages;
+(void)recentRemoteMessagesReceived;
Expand Down
5 changes: 0 additions & 5 deletions ConnectStats/src/GCAppGlobal.m
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,6 @@ +(UINavigationController*)currentNavigationController{
return [appDelegate.actionDelegate currentNavigationController];
}

+(GCSegmentOrganizer*)segments{
GCAppDelegate *appDelegate = _sharedApplicationDelegate();
return appDelegate.segments;
}

+(NSArray<NSDictionary*>*)recentRemoteMessages{
GCAppDelegate *appDelegate = _sharedApplicationDelegate();
return [appDelegate recentRemoteMessages];
Expand Down
2 changes: 2 additions & 0 deletions ConnectStats/src/GCHistoryAggregatedActivityStats.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ -(void)dealloc{
[_refOrNil release];
[_fields release];
[_foundFields release];
[_activityTypeSelection release];

[super dealloc];
}

Expand Down
11 changes: 11 additions & 0 deletions ConnectStats/src/GCStatsMultiFieldViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
#import "GCStatsDerivedHistoryViewController.h"
#import "ConnectStats-Swift.h"
@import RZUtilsSwift;
@import RZUtilsTouch;
@import RZUtilsTouchSwift;

@interface GCStatsMultiFieldViewController ()
@property (nonatomic,retain) GCHistoryPerformanceAnalysis * performanceAnalysis;
Expand Down Expand Up @@ -121,6 +123,15 @@ -(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];

[GCAppGlobal startupRefreshIfNeeded];
/*
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(){
NSIndexPath * indexPath = [NSIndexPath indexPathForRow:1 inSection:0];
[self.tableView addTooltipAt:indexPath within:self.tabBarController.view];
self.tableView.scrollEnabled = false;
//[self addTooltipInfoWithView:self.tableView];
});*/

}

-(void)viewWillAppear:(BOOL)animated{
Expand Down
71 changes: 71 additions & 0 deletions ConnectStats/src/GCTooltipView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// MIT License
//
// Created on 10/04/2021 for ConnectStats
//
// Copyright (c) 2021 Brice Rosenzweig
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//



import UIKit

class GCTooltipView: UIView {
@IBOutlet var title: UILabel!
@IBOutlet var descriptionText: UITextView!

/*
// Only override draw() if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
override func draw(_ rect: CGRect) {
// Drawing code
}
*/

static func newTooltip() -> GCTooltipView? {
guard let views = Bundle(for: self).loadNibNamed("GCTooltipView", owner: self, options: nil),
let tooltip = views[0] as? GCTooltipView
else {
return nil
}
return tooltip
}

override func awakeFromNib() {
super.awakeFromNib()
}
}

extension UIViewController {

@objc func addTooltipInfo(view : UIView) {
if let tooltip = GCTooltipView.newTooltip() {
self.view.addSubview(tooltip)

NSLayoutConstraint.activate( [
tooltip.topAnchor.constraint(equalTo: view.bottomAnchor),
tooltip.centerYAnchor.constraint(equalTo: view.centerYAnchor, constant: 0.0),
tooltip.centerXAnchor.constraint(equalTo: view.centerXAnchor, constant: 0.0),
tooltip.leadingAnchor.constraint(greaterThanOrEqualTo: self.view.leadingAnchor,constant: 30.0),
tooltip.trailingAnchor.constraint(greaterThanOrEqualTo: self.view.trailingAnchor, constant: 30.0)
])
}
}
}
Loading

0 comments on commit 7091b1f

Please sign in to comment.