Skip to content

Commit

Permalink
Background mode (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzoPrimi authored and bassosimone committed Jan 15, 2017
1 parent f42c362 commit 6a6c3e0
Show file tree
Hide file tree
Showing 21 changed files with 1,575 additions and 997 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.DS_Store
NetProbe.xcodeproj/project.xcworkspace/xcuserdata/
NetProbe.xcworkspace/xcuserdata/
ooniprobe.xcodeproj/project.xcworkspace/xcuserdata/
ooniprobe.xcworkspace/xcuserdata/
Podfile.lock
Pods/
2 changes: 1 addition & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ target 'ooniprobe' do
# pod 'measurement_kit', '~> 0.1.2.1'
pod 'measurement_kit',
:git => 'https://github.com/measurement-kit/measurement-kit.git',
:branch => 'release/v0.4.0-beta'
:branch => 'stable'
pod 'Toast'
pod 'sundown'
end
Expand Down
8 changes: 4 additions & 4 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- measurement_kit (0.4.0-alpha)
- measurement_kit (0.4.0-beta)
- sundown (0.1.0)
- Toast (3.1.0)

Expand All @@ -15,14 +15,14 @@ EXTERNAL SOURCES:

CHECKOUT OPTIONS:
measurement_kit:
:commit: 40cb030240bb20d1a686a770e818d5e818f3909d
:commit: f547d971b7a33f29cb77e0be6898b469d97d1928
:git: https://github.com/measurement-kit/measurement-kit.git

SPEC CHECKSUMS:
measurement_kit: 02e47e4625e882c7a28ff6b7eae1c9752431e4c9
measurement_kit: 1f8ac2368a6eae1018b9ded4ae8e8525ccea4438
sundown: 240edd458462fd773a474023559622c3a8566b5e
Toast: 14a93686d6c8bfe2727afd342414e35660a8a1f3

PODFILE CHECKSUM: b1d8130a811b7b0a00f119d95a460f16367657b9

COCOAPODS: 1.1.0.rc.2
COCOAPODS: 1.1.1
32 changes: 19 additions & 13 deletions ooniprobe.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
ED3AB3321D2337920061F266 /* GeoIPASNum.dat in Resources */ = {isa = PBXBuildFile; fileRef = ED3AB32F1D2337920061F266 /* GeoIPASNum.dat */; };
ED4D60561A7162C400777275 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = ED4D60541A7162C400777275 /* Localizable.strings */; };
ED58E8CA1D0C627D00C74F10 /* TestStorage.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED58E8C91D0C627D00C74F10 /* TestStorage.mm */; };
ED5AFD661E2529400039ECCB /* global.txt in Resources */ = {isa = PBXBuildFile; fileRef = ED5AFD651E2529400039ECCB /* global.txt */; };
ED8816AE1D8C6A3400D5D725 /* IntroductionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ED8816AD1D8C6A3400D5D725 /* IntroductionViewController.m */; };
ED8816B41D8C6A4B00D5D725 /* RisksViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ED8816B31D8C6A4B00D5D725 /* RisksViewController.m */; };
ED8816B71D8C6A5600D5D725 /* QuizViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ED8816B61D8C6A5600D5D725 /* QuizViewController.m */; };
ED8816BA1D8C6A6100D5D725 /* ConfigurationViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ED8816B91D8C6A6100D5D725 /* ConfigurationViewController.m */; };
ED9BBAAD1D847182005A3A57 /* urls.txt in Resources */ = {isa = PBXBuildFile; fileRef = ED9BBAAC1D847182005A3A57 /* urls.txt */; };
EDA193DA1C9AE36F00A49EAA /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EDA193D81C9AE36F00A49EAA /* Main.storyboard */; };
EDA22FFE1DD61B6400BD8708 /* UIWebView+Markdown.m in Sources */ = {isa = PBXBuildFile; fileRef = EDA22FFD1DD61B6300BD8708 /* UIWebView+Markdown.m */; };
EDC73E5D1D9B266E00245184 /* ResultSelectorViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = EDC73E5C1D9B266E00245184 /* ResultSelectorViewController.m */; };
Expand Down Expand Up @@ -105,6 +105,7 @@
ED4D60551A7162C400777275 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Localizable.strings; sourceTree = "<group>"; };
ED58E8C81D0C627D00C74F10 /* TestStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TestStorage.h; path = Utility/TestStorage.h; sourceTree = "<group>"; };
ED58E8C91D0C627D00C74F10 /* TestStorage.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = TestStorage.mm; path = Utility/TestStorage.mm; sourceTree = "<group>"; };
ED5AFD651E2529400039ECCB /* global.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = global.txt; sourceTree = "<group>"; };
ED8816AC1D8C6A3400D5D725 /* IntroductionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IntroductionViewController.h; path = "Informed consent/IntroductionViewController.h"; sourceTree = "<group>"; };
ED8816AD1D8C6A3400D5D725 /* IntroductionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = IntroductionViewController.m; path = "Informed consent/IntroductionViewController.m"; sourceTree = "<group>"; };
ED8816B21D8C6A4B00D5D725 /* RisksViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RisksViewController.h; path = "Informed consent/RisksViewController.h"; sourceTree = "<group>"; };
Expand All @@ -113,7 +114,6 @@
ED8816B61D8C6A5600D5D725 /* QuizViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = QuizViewController.m; path = "Informed consent/QuizViewController.m"; sourceTree = "<group>"; };
ED8816B81D8C6A6100D5D725 /* ConfigurationViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ConfigurationViewController.h; path = "Informed consent/ConfigurationViewController.h"; sourceTree = "<group>"; };
ED8816B91D8C6A6100D5D725 /* ConfigurationViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ConfigurationViewController.m; path = "Informed consent/ConfigurationViewController.m"; sourceTree = "<group>"; };
ED9BBAAC1D847182005A3A57 /* urls.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = urls.txt; sourceTree = "<group>"; };
EDA193D91C9AE36F00A49EAA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
EDA22FFB1DD5D39000BD8708 /* PrefixHeader.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrefixHeader.pch; sourceTree = "<group>"; };
EDA22FFC1DD61B6300BD8708 /* UIWebView+Markdown.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIWebView+Markdown.h"; path = "Utility/UIWebView+Markdown.h"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -249,7 +249,7 @@
D4A2F62E1A6C33F7001B8460 /* fixtures */ = {
isa = PBXGroup;
children = (
ED9BBAAC1D847182005A3A57 /* urls.txt */,
ED5AFD651E2529400039ECCB /* global.txt */,
D4A2F62F1A6C33F7001B8460 /* hosts.txt */,
);
path = fixtures;
Expand Down Expand Up @@ -399,7 +399,13 @@
TargetAttributes = {
D4A2F5D81A6C3244001B8460 = {
CreatedOnToolsVersion = 6.1.1;
DevelopmentTeam = YUY24YXWK4;
DevelopmentTeam = 5YRT8MW288;
ProvisioningStyle = Automatic;
SystemCapabilities = {
com.apple.BackgroundModes = {
enabled = 1;
};
};
};
};
};
Expand Down Expand Up @@ -430,7 +436,6 @@
ED3AB3311D2337920061F266 /* GeoIP.dat in Resources */,
EDE32B5E1D5CCABB00D7B4CF /* 1dc35d25e61d819a9c357074014867ab.ttf in Resources */,
EDE32B6B1D5CCABB00D7B4CF /* c8ddf1e5e5bf3682bc7bebf30f394148.woff in Resources */,
ED9BBAAD1D847182005A3A57 /* urls.txt in Resources */,
ED3AB3301D2337920061F266 /* cacert.pem in Resources */,
EDE32B731D5CCABB00D7B4CF /* index.html in Resources */,
EDCB9D911CB3F9ED00BBA3BC /* DefaultPreferences.plist in Resources */,
Expand All @@ -445,6 +450,7 @@
ED09BE331D07083A00757F4D /* tcp-connect.html in Resources */,
EDE32B611D5CCABB00D7B4CF /* 448c34a56d699c29117adc64c43affeb.woff2 in Resources */,
EDE32B6D1D5CCABB00D7B4CF /* d7c639084f684d66a1bc66855d193ed8.svg in Resources */,
ED5AFD661E2529400039ECCB /* global.txt in Resources */,
D4A2F5ED1A6C3244001B8460 /* LaunchScreen.xib in Resources */,
EDA193DA1C9AE36F00A49EAA /* Main.storyboard in Resources */,
EDEDE80C1DD1EB01002C732A /* setup-mobile.css in Resources */,
Expand Down Expand Up @@ -676,8 +682,8 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CODE_SIGN_IDENTITY = "iPhone Developer: Lorenzo Primiterra (XUC4X5K526)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Lorenzo Primiterra (XUC4X5K526)";
DEVELOPMENT_TEAM = YUY24YXWK4;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = 5YRT8MW288;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
Expand All @@ -694,8 +700,8 @@
LIBRARY_SEARCH_PATHS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = org.openobservatory.NetProbe;
PRODUCT_NAME = ooniprobe;
PROVISIONING_PROFILE = "c5d9cb6f-de80-490e-8130-cc0d4e7da888";
PROVISIONING_PROFILE_SPECIFIER = "ooniprobe-dev";
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "";
TARGETED_DEVICE_FAMILY = "1,2";
USER_HEADER_SEARCH_PATHS = "";
};
Expand All @@ -709,8 +715,8 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CODE_SIGN_IDENTITY = "iPhone Distribution: Lorenzo Primiterra (YUY24YXWK4)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Lorenzo Primiterra (YUY24YXWK4)";
DEVELOPMENT_TEAM = YUY24YXWK4;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = 5YRT8MW288;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
Expand All @@ -727,8 +733,8 @@
LIBRARY_SEARCH_PATHS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = org.openobservatory.NetProbe;
PRODUCT_NAME = ooniprobe;
PROVISIONING_PROFILE = "f5941269-8ba7-4c3f-b553-1e7483e96894";
PROVISIONING_PROFILE_SPECIFIER = "NetProbe-distr";
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "";
TARGETED_DEVICE_FAMILY = "1,2";
USER_HEADER_SEARCH_PATHS = "";
};
Expand Down
Binary file not shown.
1 change: 1 addition & 0 deletions ooniprobe/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

@property (strong, nonatomic) UIWindow *window;

- (void)registerNotifications;

@end

7 changes: 7 additions & 0 deletions ooniprobe/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,15 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
[[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys: [UIColor whiteColor], NSForegroundColorAttributeName, [UIFont fontWithName:@"HelveticaNeue" size:20], NSFontAttributeName, nil]];
[[UIBarButtonItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: [UIFont fontWithName:@"HelveticaNeue" size:16],NSFontAttributeName, nil] forState:UIControlStateNormal];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
[self registerNotifications];
return YES;
}

- (void)registerNotifications{
if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)]){
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil]];
}
}
- (void)applicationWillResignActive:(UIApplication *)application {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
Expand All @@ -35,6 +41,7 @@ - (void)applicationWillEnterForeground:(UIApplication *)application {

- (void)applicationDidBecomeActive:(UIApplication *)application {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
[UIApplication sharedApplication].applicationIconBadgeNumber = 0;
}

- (void)applicationWillTerminate:(UIApplication *)application {
Expand Down
11 changes: 11 additions & 0 deletions ooniprobe/Base.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,14 @@

"no_result" = "No results";
"no_result_msg" = "The test has no results or it was aborted";

"local_notifications" = "Run test reminder";
"local_notifications_time" = "Time";
"local_notifications_text" = "Time to run tests";

"collector_settings" = "Collector settings";
"notifications" = "Notifications";

"max_runtime" = "Max runtime (seconds)";
"test_limits" = "Test limits";
"finished_running" = "%@ finished running";
Loading

0 comments on commit 6a6c3e0

Please sign in to comment.