Skip to content

Commit

Permalink
Merge pull request phonegap#133 from OwenBrotherwood/master
Browse files Browse the repository at this point in the history
iOS HockeyApp plugin update
  • Loading branch information
shazron committed Sep 6, 2011
2 parents 59ae401 + baa9a27 commit 8556aef
Show file tree
Hide file tree
Showing 135 changed files with 717 additions and 2,969 deletions.
13 changes: 0 additions & 13 deletions iPhone/HockeyApp/HockeyApp.h

This file was deleted.

11 changes: 0 additions & 11 deletions iPhone/HockeyApp/HockeyApp.js

This file was deleted.

18 changes: 0 additions & 18 deletions iPhone/HockeyApp/HockeyApp.m

This file was deleted.

25 changes: 8 additions & 17 deletions iPhone/HockeyApp/README
@@ -1,6 +1,5 @@


HockeyApp PhoneGap Plugin
by Owen Brotherwood

http://hockeyapp.net is a fantastic help for any budding App maker.

Expand All @@ -10,31 +9,23 @@ Please note that the commercial service is based on the Open Source:
I chose the name HockeyApp as it contains the meaning of both kits...

Implements the most basic needs in the HockeyKit, via javascript :)
- checkForUpdate(): starts a check and shows a dialog as to if one should update now
- testCrash(): create a crash so one can see that the App asks to send a crash report on when the App is started again

There is a demo based on the v1.0.0 PhoneGap default Xcode Project.
- please remember to add your App ID in AppDelegate.m.
There is a demo based on the v1.0.0 PhoneGap default Xcode (4.02) Project.
The necessary js, m and h files are in the demo.


The demo was created with these steps for using the commercial service, the Open Source is just as easy but there is a 1 month free trial of the service and is a lot easier (I have tried both methods)
- Get PhoneGap from http://www.phonegap.com and install for iOS
- Try the PhoneGap default Xcode Project (note that one has to build once, then add files www and run again as of v1.0.0)
- Get the "Hockey AppKit-iOS-latest.zip" from https://github.com/TheRealKerni/HockeyKit/downloads
- Integrate into PhoneGap project: done by just reading the online docs
- Try the PhoneGap default Xcode Project (note that one has to build once, then add files by referance www (folder is in the project) and run again (this is something in PhoneGap v1.0.0 that may be fixed latter in PhoneGap)
- Get the "Hockey AppKit-iOS-latest.zip" from https://github.com/TheRealKerni/HockeyKit/downloads and add the files (I did this using group and copy)
- Place the js in www folder, the .h and .m in the PhoneGap/Plugins folder
- Add "HockeyApp" in the Plugins for PhoneGap.plist (HockeyApp string HockeyApp).
- Some html/js alterations in the index.html to call the js routines
- Remember to alter App ID in html or Plugin/HockeyApp.m

To test one has to upload a version, then bump the version and upload again. Try the App and see that it prompts for upgrade.
To test one has to upload a version to HockeyApp.net, then bump the version and upload again. Try the App and see that it prompts for upgrade.
There is a fine little button that one can push that causes instant crash. On next start of App it will ask if crash data can be sent.

The next step, remove the code from the AppDelegate.m that init's the Kits so these are done via js so that no alterations are needed in base PhoneGap code.

[[BWHockeyManager sharedHockeyManager] setAppIdentifier:@"xxx"];
[[BWQuincyManager sharedQuincyManager] setAppIdentifier:@"xxx"];

There are other structures in the Hockey Kit that could be prep'ed as well, so need some strange little js structure with reasonable defaults

https://github.com/TheRealKerni/HockeyKit/wiki/iOS-Client-API
- good list of possible functions to implement

Expand Down
Expand Up @@ -209,12 +209,21 @@ - (NSString *)installationDateString {
return [formatter stringFromDate:[NSDate dateWithTimeIntervalSinceReferenceDate:[(NSNumber *)[[NSUserDefaults standardUserDefaults] valueForKey:kDateOfVersionInstallation] doubleValue]]];
}

- (NSString *)deviceIdentifier {
if ([[UIDevice currentDevice] respondsToSelector:@selector(uniqueIdentifier)]) {
return [[UIDevice currentDevice] performSelector:@selector(uniqueIdentifier)];
}
else {
return @"invalid";
}
}

- (NSString *)authenticationToken {
return [BWmd5([NSString stringWithFormat:@"%@%@%@%@",
authenticationSecret_,
[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"],
[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"],
[[UIDevice currentDevice] uniqueIdentifier]
[self deviceIdentifier]
]
) lowercaseString];
}
Expand Down Expand Up @@ -609,7 +618,7 @@ - (void)checkForAuthorization {

[parameter appendFormat:@"?format=json&authorize=yes&app_version=%@&udid=%@",
[[[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] bw_URLEncodedString],
[[[UIDevice currentDevice] uniqueIdentifier] bw_URLEncodedString]
[[self deviceIdentifier] bw_URLEncodedString]
];

// build request & send
Expand Down Expand Up @@ -695,7 +704,7 @@ - (void)checkForUpdateShowFeedback:(BOOL)feedback {

NSMutableString *parameter = [NSMutableString stringWithFormat:@"api/2/apps/%@?format=json&udid=%@",
[[self encodedAppIdentifier_] bw_URLEncodedString],
[[[UIDevice currentDevice] uniqueIdentifier] bw_URLEncodedString]];
[[self deviceIdentifier] bw_URLEncodedString]];

// add additional statistics if user didn't disable flag
if ([self canSendUserData]) {
Expand Down Expand Up @@ -752,7 +761,7 @@ - (BOOL)initiateAppDownload {

NSString *extraParameter = [NSString string];
if ([self canSendUserData]) {
extraParameter = [NSString stringWithFormat:@"&udid=%@", [[UIDevice currentDevice] uniqueIdentifier]];
extraParameter = [NSString stringWithFormat:@"&udid=%@", [self deviceIdentifier]];
}

NSString *hockeyAPIURL = [NSString stringWithFormat:@"%@api/2/apps/%@?format=plist%@", self.updateURL, [self encodedAppIdentifier_], extraParameter];
Expand Down Expand Up @@ -982,7 +991,7 @@ - (void)setAppIdentifier:(NSString *)anAppIdentifier {
appIdentifier_ = [anAppIdentifier copy];
}

[self setUpdateURL:@"https://beta.hockeyapp.net/"];
[self setUpdateURL:@"https://rink.hockeyapp.net/"];
}

- (void)setCheckForUpdateOnLaunch:(BOOL)flag {
Expand Down
@@ -0,0 +1,87 @@
/*
Hockey.strings
Hockey

Created by Andreas Linde on 11/15/10.
Copyright 2010 buzzworks.de. All rights reserved.
Swedish translation by Joakim Ramer.
*/


/* Alert view */

/* For dialogs yes buttons */
"HockeyYes" = "Ja";

/* For dialogs no buttons */
"HockeyNo" = "Nej";

/* Update available */
"HockeyUpdateAvailable" = "Uppdatering tillgänglig";

/* Would you like to check out the new update? You can do this later on at any time in the In-App settings. */
"HockeyUpdateAlertText" = "Vill du hämta den nya uppdateringen?";


/* Update details screen */

/* Update Details */
"HockeyUpdateScreenTitle" = "Uppdatera";


/* Settings */

/* Screen title for settings view */
"HockeySettingsTitle" = "Inställningar";

/* Text asking the user to send user data (on/off switch) */
"HockeySettingsUserData" = "Skicka användardata";

/* Description text for turning on/off sending user data */
"HockeySettingsUserDataDescription" = "Skicka användardata skickar följande till utvecklaren: app version, språk, enhetstyp och iOS version.";

/* Text asking the user to send usage data (on/off switch) */
"HockeySettingsUsageData" = "Skicka användn.data";

/* Description text for turning on/off sending usage data */
"HockeySettingsUsageDataDescription" = "Skicka användningsdata skickar information om hur länge appen testats (i antal minuter), till utvecklaren.";

/* Title for defining when update checks may be made */
"HockeySectionCheckTitle" = "Leta efter uppdateringar";

/* On Startup */
"HockeySectionCheckStartup" = "Vid uppstart";

/* Daily */
"HockeySectionCheckDaily" = "Dagligen";

/* Manually */
"HockeySectionCheckManually" = "Manuellt";


"HockeyVersion" = "Version";
"HockeyShowPreviousVersions" = "Se tidigare versioner...";
"HockeyNoUpdateNeededTitle" = "Ingen uppdatering tillgänglig";
"HockeyNoUpdateNeededMessage" = "%@ är den senaste versionen.";
"HockeyUpdateAlertTextWithAppVersion" = "%@ finns.";
"HockeyIgnore" = "Ignorera";
"HockeyShowUpdate" = "Visa";
"HockeyInstallUpdate" = "Installera";
"HockeyError" = "Error";
"HockeyOK" = "OK";
"HockeyWarning" = "Varning";
"HockeyNoReleaseNotesAvailable" = "Inga releasenoteringar tillgängliga.";

"HockeyAuthorizationProgress" = "Auktoriserar...";
"HockeyAuthorizationOffline" = "Internetuppkoppling krävs!";
"HockeyAuthorizationDenied" = "Auktoriseringen nekades. Kontakta utvecklaren.";

"HockeyiOS3Message" = "In-App nedladdning kräver iOS 4 eller högre. Du kan uppdatera applikationen genoma att ladda ner IPA-filen från %@ och synka in den i iTunes.";
"HockeySimulatorMessage" = "Hockey Update fungerar inte i Simulatorn.\nitms-services:// url schemat är implementerat men fungerar ej.";

"HockeyButtonCheck" = "FRÅGA";
"HockeyButtonSearching" = "FRÅGAR";
"HockeyButtonUpdate" = "UPPDATERA";
"HockeyButtonInstalling" = "INSTALLERAR";
"HockeyButtonOffline" = "OFFLINE";
"HockeyInstalled" = "INSTALLERAD";
Expand Up @@ -213,7 +213,7 @@ - (void)setAppIdentifier:(NSString *)anAppIdentifier {
_appIdentifier = [anAppIdentifier copy];
}

[self setSubmissionURL:@"https://beta.hockeyapp.net/"];
[self setSubmissionURL:@"https://rink.hockeyapp.net/"];
}


Expand Down Expand Up @@ -422,6 +422,14 @@ - (NSString *)_getDevicePlatform {
return platform;
}

- (NSString *)deviceIdentifier {
if ([[UIDevice currentDevice] respondsToSelector:@selector(uniqueIdentifier)]) {
return [[UIDevice currentDevice] performSelector:@selector(uniqueIdentifier)];
}
else {
return @"invalid";
}
}

- (void)_performSendingCrashReports {
NSMutableDictionary *approvedCrashReports = [NSMutableDictionary dictionaryWithDictionary:[[NSUserDefaults standardUserDefaults] dictionaryForKey: kApprovedCrashReports]];
Expand All @@ -434,7 +442,7 @@ - (void)_performSendingCrashReports {
NSString *description = @"";

if (self.autoSubmitDeviceUDID) {
userid = [[UIDevice currentDevice] uniqueIdentifier];
userid = [self deviceIdentifier];
} else if (self.delegate != nil && [self.delegate respondsToSelector:@selector(crashReportUserID)]) {
userid = [self.delegate crashReportUserID];
}
Expand Down
Binary file not shown.

0 comments on commit 8556aef

Please sign in to comment.