Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OsmAnd on Apple Watch #69

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2,237 changes: 2,233 additions & 4 deletions OsmAnd.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
OsmAnd-ios
OsmAnd on the Apple Watch
==========

OsmAnd for iOS
This is an extension for OsmAnd on iOS implementing an extension for the Apple Watch. The smartwatch app connects with OsmAnd and shows the current location on a zoomable map, no matter which map type was chosen on the iPhone. Additionally, if OsmAnd is in navigation mode, the navigation instructions for the current route are transmitted to the Apple Watch. These include the distance to the next waypoint as well as the direction in which one should move on. This directional instruction is also calculated in respect to the current walking direction. At each new waypoint that has been reached a subtle vibration on the wrist indicates a navigation update. Finally, each waypoint has a reverse geocoded street name, improving pedestrian navigation even further.
![navi0](https://raw.githubusercontent.com/and01/OsmAnd-ios/717bd6f4719ebbff53343be9f34d637bada2ece1/wiki/wiki2.jpg)
![navi1](https://raw.githubusercontent.com/and01/OsmAnd-ios/717bd6f4719ebbff53343be9f34d637bada2ece1/wiki/wiki0.png)
![navi1](https://raw.githubusercontent.com/and01/OsmAnd-ios/717bd6f4719ebbff53343be9f34d637bada2ece1/wiki/wiki1.png)
6 changes: 6 additions & 0 deletions Resources/Images.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@
"filename" : "osmand-ipad7@2x.png",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
},
{
"size" : "24x24",
"idiom" : "watch",
Expand Down Expand Up @@ -143,6 +148,7 @@
{
"size" : "40x40",
"idiom" : "watch",
"filename" : "osmand-spot-ipad7@2x-1.png",
"scale" : "2x",
"role" : "appLauncher",
"subtype" : "38mm"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
143 changes: 74 additions & 69 deletions Resources/OsmAnd-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
Expand All @@ -20,29 +25,29 @@
<string>net.osmand.gpx</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Map Creator SQLite Database</string>
<key>CFBundleTypeIconFiles</key>
<array/>
<key>CFBundleTypeExtensions</key>
<array>
<string>sqlitedb</string>
</array>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/x-sqlite3</string>
<string>application/octet-stream</string>
</array>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>net.osmand.sqlitedb</string>
</array>
<key>NSPersistentStoreTypeKey</key>
<string>SQLite</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Map Creator SQLite Database</string>
<key>CFBundleTypeIconFiles</key>
<array/>
<key>CFBundleTypeExtensions</key>
<array>
<string>sqlitedb</string>
</array>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/x-sqlite3</string>
<string>application/octet-stream</string>
</array>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>net.osmand.sqlitedb</string>
</array>
<key>NSPersistentStoreTypeKey</key>
<string>SQLite</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
Expand Down Expand Up @@ -136,29 +141,29 @@
<string>application/gpx+xml</string>
</dict>
</dict>
<dict>
<key>UTTypeIdentifier</key>
<string>net.osmand.sqlitedb</string>
<key>UTTypeDescription</key>
<string>Map Creator SQLite Database</string>
<key>UTTypeConformsTo</key>
<array>
<string>public.database</string>
<string>public.data</string>
</array>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>sqlitedb</string>
</array>
<key>public.mime-type</key>
<array>
<string>application/x-sqlite3</string>
<string>application/octet-stream</string>
</array>
</dict>
</dict>
<dict>
<key>UTTypeIdentifier</key>
<string>net.osmand.sqlitedb</string>
<key>UTTypeDescription</key>
<string>Map Creator SQLite Database</string>
<key>UTTypeConformsTo</key>
<array>
<string>public.database</string>
<string>public.data</string>
</array>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>sqlitedb</string>
</array>
<key>public.mime-type</key>
<array>
<string>application/x-sqlite3</string>
<string>application/octet-stream</string>
</array>
</dict>
</dict>
</array>
<key>UTImportedTypeDeclarations</key>
<array>
Expand All @@ -182,29 +187,29 @@
<string>application/gpx+xml</string>
</dict>
</dict>
<dict>
<key>UTTypeIdentifier</key>
<string>net.osmand.sqlitedb</string>
<key>UTTypeDescription</key>
<string>Map Creator SQLite Database</string>
<key>UTTypeConformsTo</key>
<array>
<string>public.database</string>
<string>public.data</string>
</array>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>sqlitedb</string>
</array>
<key>public.mime-type</key>
<array>
<string>application/x-sqlite3</string>
<string>application/octet-stream</string>
</array>
</dict>
</dict>
<dict>
<key>UTTypeIdentifier</key>
<string>net.osmand.sqlitedb</string>
<key>UTTypeDescription</key>
<string>Map Creator SQLite Database</string>
<key>UTTypeConformsTo</key>
<array>
<string>public.database</string>
<string>public.data</string>
</array>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>sqlitedb</string>
</array>
<key>public.mime-type</key>
<array>
<string>application/x-sqlite3</string>
<string>application/octet-stream</string>
</array>
</dict>
</dict>
</array>
</dict>
</plist>
4 changes: 4 additions & 0 deletions Resources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,10 @@
"product_desc_srtm" = "Display of contour lines";
"product_desc_ext_srtm" = "This plugin provides contour lines and hillshade, which can be displayed in OsmAnd offline maps. Contour lines provide the information about heights of the area while hillshade is their visualization. See the names of mountain peaks and specific features of terrain using this plugin.\n\nThe global data (between 70 degrees north and 70 degrees south) is based on measurements by SRTM (Shuttle Radar Topography Mission) and ASTER (Advanced Spaceborne Thermal Emission and Reflection Radiometer), an imaging instrument onboard Terra, the flagship satellite of NASA's Earth Observing System. ASTER is a cooperative effort between NASA, Japan's Ministry of Economy, Trade and Industry (METI), and Japan Space Systems (J-spacesystems).";

"product_title_smartNaviWatch" = "Smart Navi Watch";
"product_desc_smartNaviWatch" = "Show your current location right on your Apple Watch and get navigation updates on your wrist.";
"product_desc_ext_smartNaviWatch" = "Smart Navi Watch plugin allows you to fetch a zoomable map of your current location on your Apple Watch. Additionaly, you can get navigation updates of your current route. You need to install this extension in your Watch app on your iPhone.";

"my_location" = "My Location";
"all_categories" = "All categories";
"get_unlimited_access" = "Get unlimited access";
Expand Down
13 changes: 13 additions & 0 deletions SmartNaviWatch Extension/ComplicationController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// ComplicationController.h
// SmartNaviWatch Extension
//
// Created by egloff on 16/12/15.
// Copyright © 2015 OsmAnd. All rights reserved.
//

#import <ClockKit/ClockKit.h>

@interface ComplicationController : NSObject <CLKComplicationDataSource>

@end
66 changes: 66 additions & 0 deletions SmartNaviWatch Extension/ComplicationController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
//
// ComplicationController.m
// SmartNaviWatch Extension
//
// Created by egloff on 16/12/15.
// Copyright © 2015 OsmAnd. All rights reserved.
//

#import "ComplicationController.h"

@interface ComplicationController ()

@end

@implementation ComplicationController

#pragma mark - Timeline Configuration

- (void)getSupportedTimeTravelDirectionsForComplication:(CLKComplication *)complication withHandler:(void(^)(CLKComplicationTimeTravelDirections directions))handler {
handler(CLKComplicationTimeTravelDirectionForward|CLKComplicationTimeTravelDirectionBackward);
}

- (void)getTimelineStartDateForComplication:(CLKComplication *)complication withHandler:(void(^)(NSDate * __nullable date))handler {
handler(nil);
}

- (void)getTimelineEndDateForComplication:(CLKComplication *)complication withHandler:(void(^)(NSDate * __nullable date))handler {
handler(nil);
}

- (void)getPrivacyBehaviorForComplication:(CLKComplication *)complication withHandler:(void(^)(CLKComplicationPrivacyBehavior privacyBehavior))handler {
handler(CLKComplicationPrivacyBehaviorShowOnLockScreen);
}

#pragma mark - Timeline Population

- (void)getCurrentTimelineEntryForComplication:(CLKComplication *)complication withHandler:(void(^)(CLKComplicationTimelineEntry * __nullable))handler {
// Call the handler with the current timeline entry
handler(nil);
}

- (void)getTimelineEntriesForComplication:(CLKComplication *)complication beforeDate:(NSDate *)date limit:(NSUInteger)limit withHandler:(void(^)(NSArray<CLKComplicationTimelineEntry *> * __nullable entries))handler {
// Call the handler with the timeline entries prior to the given date
handler(nil);
}

- (void)getTimelineEntriesForComplication:(CLKComplication *)complication afterDate:(NSDate *)date limit:(NSUInteger)limit withHandler:(void(^)(NSArray<CLKComplicationTimelineEntry *> * __nullable entries))handler {
// Call the handler with the timeline entries after to the given date
handler(nil);
}

#pragma mark Update Scheduling

- (void)getNextRequestedUpdateDateWithHandler:(void(^)(NSDate * __nullable updateDate))handler {
// Call the handler with the date when you would next like to be given the opportunity to update your complication content
handler(nil);
}

#pragma mark - Placeholder Templates

- (void)getPlaceholderTemplateForComplication:(CLKComplication *)complication withHandler:(void(^)(CLKComplicationTemplate * __nullable complicationTemplate))handler {
// This method will be called once per supported complication, and the results will be cached
handler(nil);
}

@end
23 changes: 23 additions & 0 deletions SmartNaviWatch Extension/ErrorMessageController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// ErrorMessageController.h
// OsmAnd
//
// Created by egloff on 31/01/16.
// Copyright © 2016 OsmAnd. All rights reserved.
//
/*!
* This controller is presented modally allowing the user
* to inform about possible error messages.
*/
#import <WatchKit/WatchKit.h>

@interface ErrorMessageController : WKInterfaceController

@property (unsafe_unretained, nonatomic) IBOutlet WKInterfaceLabel *errorMessageLabel;

/*!
* dismisses this controller
*/
- (IBAction)dismissErrorMessageController;

@end
34 changes: 34 additions & 0 deletions SmartNaviWatch Extension/ErrorMessageController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// ErrorMessageController.m
// OsmAnd
//
// Created by egloff on 31/01/16.
// Copyright © 2016 OsmAnd. All rights reserved.
//

#import "ErrorMessageController.h"

@implementation ErrorMessageController

- (void)awakeWithContext:(id)context {
[super awakeWithContext:context];

if (context != nil) {
[self.errorMessageLabel setText:context];
}


}

- (void)willActivate {
// This method is called when watch view controller is about to be visible to user
[super willActivate];

}


- (IBAction)dismissErrorMessageController {

[self dismissController];
}
@end
33 changes: 33 additions & 0 deletions SmartNaviWatch Extension/ExtensionDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// ExtensionDelegate.h
// SmartNaviWatch Extension
//
// Created by egloff on 16/12/15.
// Copyright © 2015 OsmAnd. All rights reserved.
//
/*!
* This singleton class contains the startup code and therefore conforms
* to both WKExtensionDelegate as well as WCSessionDelegate.
*/
#import <WatchKit/WatchKit.h>
@import WatchConnectivity;

@interface ExtensionDelegate : NSObject <WKExtensionDelegate, WCSessionDelegate> {

NSInteger numberOfPages;

}

@property (nonatomic, retain) NSMutableArray *imageData;
@property (nonatomic, retain) NSString *locationInfo;
@property (nonatomic, retain) NSArray *waypoints;
@property (nonatomic, retain) NSString *currentNavigationTitle;
@property (nonatomic, retain) NSNumber *currentNavigationIndex;
@property (nonatomic, assign) BOOL mapInitialized;

/*!
* sends a location request
*/
-(void)sendLocationRequest;

@end
Loading